├── settings.gradle
├── img
├── horse.png
├── inventory.png
├── slot-sell.png
├── assassin-gloves.png
├── craft-extensions.png
└── horse-summoning-stone.png
├── gradle
├── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
└── publish.gradle
├── gradle.properties
├── src
├── main
│ ├── resources
│ │ ├── backpacks.yml
│ │ ├── plugin.yml
│ │ ├── items.yml
│ │ ├── lang
│ │ │ ├── zh.lang
│ │ │ ├── jp.lang
│ │ │ ├── kr.lang
│ │ │ ├── rs.lang
│ │ │ ├── en.lang
│ │ │ ├── cs.lang
│ │ │ ├── tr.lang
│ │ │ ├── ru.lang
│ │ │ ├── pt.lang
│ │ │ ├── es.lang
│ │ │ └── de.lang
│ │ ├── pets.yml.legacy
│ │ ├── pets.yml
│ │ └── slots.yml
│ └── java
│ │ └── ru
│ │ └── endlesscode
│ │ └── rpginventory
│ │ ├── compat
│ │ ├── PlayerCompat.java
│ │ ├── MaterialCompat.java
│ │ ├── mimic
│ │ │ ├── RPGInventoryPlayerInventory.java
│ │ │ └── RPGInventoryItemsRegistry.java
│ │ └── VersionHandler.java
│ │ ├── event
│ │ ├── ItemCommandEvent.java
│ │ ├── PetUnequipEvent.java
│ │ ├── listener
│ │ │ ├── WorldListener.java
│ │ │ ├── PlayerListener.java
│ │ │ ├── HandSwapListener.java
│ │ │ ├── ElytraListener.java
│ │ │ ├── LockerListener.java
│ │ │ └── CraftListener.java
│ │ ├── PlayerInventoryUnloadEvent.java
│ │ ├── PetEquipEvent.java
│ │ ├── PlayerInventoryLoadEvent.java
│ │ └── updater
│ │ │ └── StatsUpdater.java
│ │ ├── utils
│ │ ├── Utils.java
│ │ ├── CommandUtils.java
│ │ ├── FileUtils.java
│ │ ├── SafeEnums.java
│ │ ├── Log.java
│ │ ├── NbtFactoryMirror.java
│ │ ├── PlayerUtils.java
│ │ ├── EntityUtils.java
│ │ └── InventoryUtils.java
│ │ ├── misc
│ │ ├── config
│ │ │ ├── TexturesType.java
│ │ │ ├── VanillaSlotAction.java
│ │ │ └── Config.java
│ │ └── serialization
│ │ │ ├── InventorySnapshot.java
│ │ │ ├── SlotSnapshot.java
│ │ │ ├── Serialization.java
│ │ │ └── LegacySerialization.java
│ │ ├── item
│ │ ├── TexturedItem.java
│ │ ├── ItemAction.java
│ │ ├── ClassedItem.java
│ │ ├── ItemStat.java
│ │ └── Modifier.java
│ │ ├── pet
│ │ ├── Attributes.java
│ │ ├── PetFood.java
│ │ └── CooldownTimer.java
│ │ ├── inventory
│ │ ├── backpack
│ │ │ ├── BackpackHolder.java
│ │ │ ├── BackpackUpdater.java
│ │ │ ├── BackpackType.java
│ │ │ └── Backpack.java
│ │ ├── ActionType.java
│ │ ├── slot
│ │ │ └── ActionSlot.java
│ │ ├── craft
│ │ │ ├── CraftExtension.java
│ │ │ └── CraftManager.java
│ │ └── ArmorType.java
│ │ ├── RPGInventoryPlugin.java
│ │ └── api
│ │ ├── PetAPI.java
│ │ └── InventoryAPI.java
└── test
│ └── java
│ └── ru
│ └── endlesscode
│ └── rpginventory
│ └── utils
│ ├── LogTest.java
│ └── VersionTest.java
├── .travis.yml
├── README.md
├── .gitlab
└── issue_templates
│ ├── Exception Report.md
│ ├── Feature Request.md
│ └── Bug Report.md
├── .gitlab-ci.yml
├── .gitignore
├── proguard.gradle
├── proguard
└── proguard-rules.pro
└── gradlew.bat
/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'rpginventory'
2 |
--------------------------------------------------------------------------------
/img/horse.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EndlessCodeGroup/RPGInventory/HEAD/img/horse.png
--------------------------------------------------------------------------------
/img/inventory.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EndlessCodeGroup/RPGInventory/HEAD/img/inventory.png
--------------------------------------------------------------------------------
/img/slot-sell.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EndlessCodeGroup/RPGInventory/HEAD/img/slot-sell.png
--------------------------------------------------------------------------------
/img/assassin-gloves.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EndlessCodeGroup/RPGInventory/HEAD/img/assassin-gloves.png
--------------------------------------------------------------------------------
/img/craft-extensions.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EndlessCodeGroup/RPGInventory/HEAD/img/craft-extensions.png
--------------------------------------------------------------------------------
/img/horse-summoning-stone.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EndlessCodeGroup/RPGInventory/HEAD/img/horse-summoning-stone.png
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EndlessCodeGroup/RPGInventory/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | pluginVersion=2.4.1
2 | pluginDesc=Change inventory how you need
3 | url=https://github.com/EndlessCodeGroup/RPGInventory
4 |
5 | org.gradle.caching=true
6 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/src/main/resources/backpacks.yml:
--------------------------------------------------------------------------------
1 | backpacks:
2 | small:
3 | item: DIAMOND_HOE:20
4 | name: "&7Small backpack"
5 | lore:
6 | - "&e&oIt seems a trifle, but useful"
7 | size: 5
8 | medium:
9 | item: DIAMOND_HOE:21
10 | name: "&6Medium backpack"
11 | lore:
12 | - "&e&oHere your text"
13 | size: 10
14 | large:
15 | item: DIAMOND_HOE:22
16 | name: "&5Large backpack"
17 | lore:
18 | - "&e&oOh, its really big!"
19 | size: 15
20 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: java
2 |
3 | jdk:
4 | - openjdk8
5 |
6 | before_install:
7 | - chmod +x gradlew
8 |
9 | before_cache:
10 | - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
11 | - rm -fr $HOME/.gradle/caches/*/plugin-resolution/
12 |
13 | cache:
14 | directories:
15 | - $HOME/.gradle/caches/
16 | - $HOME/.gradle/wrapper/
17 | - $HOME/.m2/
18 |
19 | after_success:
20 | - bash <(curl -s https://codecov.io/bash)
21 |
22 | notifications:
23 | email:
24 | on_success: never
25 | on_failure: always
26 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # RPGInventory [](https://www.spigotmc.org/resources/12498/updates) [](#) [](https://travis-ci.org/EndlessCodeGroup/RPGInventory)
2 | [](https://discord.gg/RBDHyuu)
3 | 
4 |
5 | This plugin will add many RPG features to your server, main of which - RPG-style inventory.
6 | > **You can find screenshots and more info on [SpigotMC](https://www.spigotmc.org/resources/11809/).**
7 |
--------------------------------------------------------------------------------
/src/main/java/ru/endlesscode/rpginventory/compat/PlayerCompat.java:
--------------------------------------------------------------------------------
1 | package ru.endlesscode.rpginventory.compat;
2 |
3 | import org.bukkit.entity.Player;
4 |
5 | public final class PlayerCompat {
6 |
7 | private static boolean isGetWidthMethodAvailable = VersionHandler.getVersionCode() >= VersionHandler.VERSION_1_11;
8 |
9 | private PlayerCompat() {
10 | }
11 |
12 | public static double getWidth(Player player) {
13 | double playerWidth = 0.6D;
14 | if (isGetWidthMethodAvailable) {
15 | try {
16 | playerWidth = player.getWidth();
17 | } catch (NoSuchMethodError ex) {
18 | isGetWidthMethodAvailable = false;
19 | }
20 | }
21 | return playerWidth;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/.gitlab/issue_templates/Exception Report.md:
--------------------------------------------------------------------------------
1 |
5 |
6 | **Prerequisites**
7 | * [ ] Are you running the latest version?
8 | * [ ] Did you perform a cursory search?
9 |
10 | **Exception stacktrace**
11 | ```
12 | PUT YOUR STACKTRACE HERE
13 | ```
14 |
15 | **To Reproduce**
16 |
22 |
23 | **Environment:**
24 | - Server Core:
25 | - Server Version:
26 | - Plugin Version:
27 |
28 | **Additional context**
29 |
33 |
--------------------------------------------------------------------------------
/.gitlab/issue_templates/Feature Request.md:
--------------------------------------------------------------------------------
1 |
5 |
6 | **Prerequisites**
7 | * [ ] Did you check the [Wiki](http://rpginventory.endlesscode.ru/) for this feature?
8 | * [ ] Did you perform a cursory search?
9 |
10 | **Is your feature request related to a problem? Please describe.**
11 |
12 |
13 | **Describe the solution you'd like**
14 |
15 |
16 | **Describe alternatives you've considered**
17 |
18 |
19 | **Additional context**
20 |
21 |
--------------------------------------------------------------------------------
/.gitlab-ci.yml:
--------------------------------------------------------------------------------
1 | image: gradle:alpine
2 |
3 | # Disable the Gradle daemon for Continuous Integration servers as correctness
4 | # is usually a priority over speed in CI environments. Using a fresh
5 | # runtime for each build is more reliable since the runtime is completely
6 | # isolated from any previous builds.
7 | variables:
8 | GRADLE_OPTS: "-Dorg.gradle.daemon=false"
9 |
10 | before_script:
11 | - export GRADLE_USER_HOME=`pwd`/.gradle
12 |
13 | build:
14 | stage: build
15 | script: gradle build
16 | only:
17 | - push
18 | except:
19 | - develop
20 | cache:
21 | key: "$CI_COMMIT_REF_NAME"
22 | policy: push
23 | paths:
24 | - build
25 | - .gradle
26 |
27 | test:
28 | stage: test
29 | script: gradle check
30 | only:
31 | - push
32 | except:
33 | - develop
34 | cache:
35 | key: "$CI_COMMIT_REF_NAME"
36 | policy: pull
37 | paths:
38 | - build
39 | - .gradle
40 |
41 | deploy:
42 | stage: deploy
43 | script: gradle build
44 | only:
45 | - develop
46 | artifacts:
47 | paths:
48 | - build/libs/*
49 |
--------------------------------------------------------------------------------
/src/main/java/ru/endlesscode/rpginventory/compat/MaterialCompat.java:
--------------------------------------------------------------------------------
1 | package ru.endlesscode.rpginventory.compat;
2 |
3 | import org.bukkit.Material;
4 | import org.jetbrains.annotations.NotNull;
5 | import org.jetbrains.annotations.Nullable;
6 |
7 | import java.util.Objects;
8 |
9 | public class MaterialCompat {
10 | @NotNull
11 | public static Material getMaterial(String name) {
12 | return Objects.requireNonNull(getMaterialOrNull(name));
13 | }
14 |
15 | @NotNull
16 | public static Material getMaterialOrAir(String name) {
17 | Material material = getMaterialOrNull(name);
18 | if (material == null) {
19 | return Material.AIR;
20 | } else {
21 | return material;
22 | }
23 | }
24 |
25 | @Nullable
26 | public static Material getMaterialOrNull(String name) {
27 | Material material = Material.getMaterial(name);
28 | if (material == null && !VersionHandler.isLegacy()) {
29 | material = Material.getMaterial(name, true);
30 | }
31 |
32 | return material;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ### JetBrains template
2 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
3 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
4 |
5 | # User-specific stuff:
6 | /.idea/
7 | *.iml
8 |
9 | ## Plugin-specific files:
10 |
11 | # IntelliJ
12 | /out/
13 | /classes/
14 |
15 | # mpeltonen/sbt-idea plugin
16 | .idea_modules/
17 |
18 | ### Java template
19 | *.class
20 |
21 | # Package Files #
22 | *.jar
23 | *.war
24 | *.ear
25 |
26 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
27 | hs_err_pid*
28 |
29 | ### Gradle template
30 | .gradle
31 | /build/
32 |
33 | # Ignore Gradle GUI config
34 | gradle-app.setting
35 |
36 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
37 | !gradle-wrapper.jar
38 |
39 | # Cache of project
40 | .gradletasknamecache
41 |
42 | # # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
43 | # gradle/wrapper/gradle-wrapper.properties
44 |
45 | !/libs/*.jar
46 | !/antlibs/*.jar
47 |
48 | # Local files
49 | local.properties
50 |
--------------------------------------------------------------------------------
/proguard.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | def proguardVersion = "6.0.3"
3 | dependencies {
4 | classpath("net.sf.proguard:proguard-gradle:$proguardVersion")
5 | }
6 |
7 | repositories {
8 | mavenCentral()
9 | }
10 | }
11 |
12 | task minimizeJar(type: proguard.gradle.ProGuardTask, dependsOn: shadowJar) {
13 | // We will minimize result of shadowJar task
14 | def jarFile = (tasks.shadowJar as Jar).archivePath
15 |
16 | // Specify the input jars and output jars
17 | injars(jarFile.path)
18 | outjars("${jarFile.parent}/${jarFile.name.replace("-all", ".min")}")
19 |
20 | // Don't obfuscate/minimize calls of provided libraries
21 | libraryjars("${System.properties.'java.home'}/lib/rt.jar")
22 | def providedLibs = project.configurations.compileOnly
23 | for (lib in providedLibs) {
24 | libraryjars(lib.path)
25 | }
26 |
27 | // More logs
28 | verbose
29 |
30 | // Proguard warnings will not stop build
31 | ignorewarnings
32 | dontwarn
33 |
34 | // Import static configurations
35 | configuration("proguard/proguard-rules.pro")
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/ru/endlesscode/rpginventory/event/ItemCommandEvent.java:
--------------------------------------------------------------------------------
1 | package ru.endlesscode.rpginventory.event;
2 |
3 | import org.bukkit.entity.Player;
4 | import org.bukkit.event.Cancellable;
5 | import org.bukkit.event.HandlerList;
6 | import org.bukkit.event.player.PlayerEvent;
7 | import org.bukkit.inventory.ItemStack;
8 | import org.jetbrains.annotations.NotNull;
9 |
10 | public class ItemCommandEvent extends PlayerEvent implements Cancellable {
11 |
12 | private static final HandlerList handlers = new HandlerList();
13 | private boolean cancelled;
14 |
15 | private ItemStack item;
16 |
17 | public ItemCommandEvent(Player player, ItemStack item) {
18 | super(player);
19 | this.item = item;
20 | }
21 |
22 | public ItemStack getItem() {
23 | return item;
24 | }
25 |
26 | public void setItem(ItemStack item) {
27 | this.item = item;
28 | }
29 |
30 | @Override
31 | public boolean isCancelled() {
32 | return cancelled;
33 | }
34 |
35 | @Override
36 | public void setCancelled(boolean cancelled) {
37 | this.cancelled = cancelled;
38 | }
39 |
40 | @NotNull
41 | @Override
42 | public HandlerList getHandlers() {
43 | return handlers;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/ru/endlesscode/rpginventory/utils/Utils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of RPGInventory.
3 | * Copyright (C) 2015-2017 Osip Fatkullin
4 | *
5 | * RPGInventory is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * RPGInventory is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with RPGInventory. If not, see .
17 | */
18 |
19 | package ru.endlesscode.rpginventory.utils;
20 |
21 | import java.math.BigDecimal;
22 |
23 | /**
24 | * Created by OsipXD on 20.05.2016
25 | * It is part of the RpgInventory.
26 | * All rights reserved 2014 - 2016 © «EndlessCode Group»
27 | */
28 | public class Utils {
29 | public static double round(double a, int scale) {
30 | return new BigDecimal(a).setScale(scale, BigDecimal.ROUND_HALF_UP).doubleValue();
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/main/java/ru/endlesscode/rpginventory/misc/config/TexturesType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of RPGInventory.
3 | * Copyright (C) 2020 EndlessCode Group and contributors
4 | *
5 | * RPGInventory is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * RPGInventory is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with RPGInventory. If not, see .
17 | */
18 |
19 | package ru.endlesscode.rpginventory.misc.config;
20 |
21 | import ru.endlesscode.rpginventory.utils.SafeEnums;
22 |
23 | @SuppressWarnings("unused")
24 | public enum TexturesType {
25 | DAMAGE,
26 | CUSTOM_MODEL_DATA;
27 |
28 | static TexturesType parseString(String stringValue) {
29 | return SafeEnums.valueOfOrDefault(TexturesType.class, stringValue, DAMAGE, "textures type");
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/main/java/ru/endlesscode/rpginventory/item/TexturedItem.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of RPGInventory.
3 | * Copyright (C) 2015-2017 Osip Fatkullin
4 | *
5 | * RPGInventory is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * RPGInventory is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with RPGInventory. If not, see .
17 | */
18 |
19 | package ru.endlesscode.rpginventory.item;
20 |
21 | /**
22 | * Created by OsipXD on 28.08.2016
23 | * It is part of the RpgInventory.
24 | * All rights reserved 2014 - 2016 © «EndlessCode Group»
25 | */
26 | public class TexturedItem {
27 | protected final Texture texture;
28 |
29 | protected TexturedItem(Texture texture) {
30 | this.texture = texture;
31 | }
32 |
33 | public int getTextureData() {
34 | return texture.getData();
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/resources/plugin.yml:
--------------------------------------------------------------------------------
1 | depend:
2 | - ProtocolLib
3 | - Vault
4 | softdepend:
5 | - Mimic
6 | - MyPet
7 | - PlaceholderAPI
8 |
9 | commands:
10 | rpginventory:
11 | description: RPGInventory command.
12 | aliases: [rpginv]
13 | usage: /
14 |
15 | permissions:
16 | rpginventory.admin:
17 | description: Gives access to all RPGInventory commands
18 | default: op
19 | children:
20 | rpginventory.user: true
21 | rpginventory.open.others: true
22 | rpginventory.user:
23 | description: Gives access to all user commands
24 | default: true
25 | children:
26 | rpginventory.open: true
27 | rpginventory.open:
28 | description: Allows you to open inventory by command
29 | default: true
30 | rpginventory.open.others:
31 | description: Allows you to open your or other player's inventory by command
32 | default: op
33 | children:
34 | rpginventory.open: true
35 | rpginventory.keep.items:
36 | description: Player with this permission will not lose any items on dead
37 | default: op
38 | rpginventory.keep.armor:
39 | description: Player with this permission will not lose armor on dead
40 | default: op
41 | rpginventory.keep.rpginv:
42 | description: Player with this permission will not lose items from RPGInventory on dead
43 | default: op
44 |
--------------------------------------------------------------------------------
/src/main/java/ru/endlesscode/rpginventory/pet/Attributes.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of RPGInventory.
3 | * Copyright (C) 2015-2017 Osip Fatkullin
4 | *
5 | * RPGInventory is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * RPGInventory is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with RPGInventory. If not, see .
17 | */
18 |
19 | package ru.endlesscode.rpginventory.pet;
20 |
21 | import java.util.UUID;
22 |
23 | public class Attributes {
24 | public static final String SPEED_MODIFIER = "RPGInventory Speed Bonus";
25 | public static final UUID SPEED_MODIFIER_ID = UUID.fromString("2deaf4fc-1673-4c5b-ac4f-25e37e08760f");
26 |
27 | static final double ONE_BPS = 0.10638297872;
28 | static final double GALLOP_MULTIPLIER = 4.46808510803;
29 |
30 | private Attributes() {
31 | // Shouldn't be instantiated
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/java/ru/endlesscode/rpginventory/misc/config/VanillaSlotAction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of RPGInventory.
3 | * Copyright (C) 2018 EndlessCode Group and contributors
4 | *
5 | * RPGInventory is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * RPGInventory is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with RPGInventory. If not, see .
17 | */
18 |
19 | package ru.endlesscode.rpginventory.misc.config;
20 |
21 | import ru.endlesscode.rpginventory.utils.SafeEnums;
22 |
23 | public enum VanillaSlotAction {
24 |
25 | /**
26 | * Do vanilla action.
27 | */
28 | DEFAULT,
29 |
30 | /**
31 | * Open RPG inventory.
32 | */
33 | RPGINV;
34 |
35 |
36 | static VanillaSlotAction parseString(String stringValue) {
37 | return SafeEnums.valueOfOrDefault(VanillaSlotAction.class, stringValue, DEFAULT, "slot action");
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/ru/endlesscode/rpginventory/compat/mimic/RPGInventoryPlayerInventory.java:
--------------------------------------------------------------------------------
1 | package ru.endlesscode.rpginventory.compat.mimic;
2 |
3 | import org.bukkit.entity.Player;
4 | import org.bukkit.inventory.ItemStack;
5 | import org.jetbrains.annotations.NotNull;
6 | import ru.endlesscode.mimic.inventory.BukkitPlayerInventory;
7 | import ru.endlesscode.rpginventory.api.InventoryAPI;
8 | import ru.endlesscode.rpginventory.inventory.slot.Slot;
9 | import ru.endlesscode.rpginventory.inventory.slot.SlotManager;
10 |
11 | import java.util.List;
12 | import java.util.stream.Collectors;
13 |
14 | @SuppressWarnings("UnstableApiUsage")
15 | public class RPGInventoryPlayerInventory extends BukkitPlayerInventory {
16 |
17 | public RPGInventoryPlayerInventory(@NotNull Player player) {
18 | super(player);
19 | }
20 |
21 | @NotNull
22 | @Override
23 | public List getEquippedItems() {
24 | List passiveItems = InventoryAPI.getPassiveItems(getPlayer());
25 | return collectEquippedItems(passiveItems);
26 | }
27 |
28 | @NotNull
29 | @Override
30 | public List getStoredItems() {
31 | List quickSlots = SlotManager.instance().getQuickSlots();
32 |
33 | return collectStoredItems()
34 | .stream()
35 | .filter(item -> quickSlots.stream().noneMatch(slot -> slot.isCup(item)))
36 | .collect(Collectors.toList());
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/.gitlab/issue_templates/Bug Report.md:
--------------------------------------------------------------------------------
1 |
5 |
6 | **Prerequisites**
7 | * [ ] Are you running the latest version?
8 | * [ ] Did you check the FAQs on [plugin's page](https://www.spigotmc.org/resources/12498/)?
9 | * [ ] Did you check the [Wiki](http://rpginventory.endlesscode.ru/)?
10 | * [ ] Did you configure [config.yml](https://github.com/EndlessCodeGroup/RPGInventory/blob/master/src/main/resources/config.yml)?
11 | * [ ] Did you perform a cursory search?
12 | * [ ] Can you reproduce the problem on clean server (with installed only the plugin and dependencies)?
13 |
14 | **Describe the bug**
15 |
16 |
17 | **To Reproduce**
18 |
25 |
26 | **Expected behavior**
27 |
28 |
29 | **Screenshots or video**
30 |
31 |
32 | **Environment:**
33 | - Server Core:
34 | - Server Version:
35 | - Plugin Version:
36 |
37 | **Additional context**
38 |
42 |
--------------------------------------------------------------------------------
/src/main/resources/items.yml:
--------------------------------------------------------------------------------
1 | items:
2 | assassin-gloves:
3 | texture: DIAMOND_HOE:24
4 | name: "Assassin gloves"
5 | lore:
6 | - "&e&oFaster than the wind..."
7 | rarity: RARE
8 | unbreakable: true
9 | level: 4
10 | classes:
11 | - Assassin
12 | stats:
13 | - DAMAGE +5-10
14 | - BOW_DAMAGE +2
15 | - HAND_DAMAGE +3
16 | - CRIT_CHANCE +2%
17 | - SPEED +30%
18 | - JUMP +4
19 | ring-of-gods:
20 | texture: DIAMOND_HOE:23
21 | name: "Ring of Gods"
22 | lore:
23 | - "&e&oWith this ring the Gods"
24 | - "&e&orule the world!"
25 | rarity: LEGENDARY
26 | drop: false
27 | abilities:
28 | permissions:
29 | - essentials.gamemode
30 | right-click:
31 | op: true
32 | command: "time set day"
33 | lore: "Set day"
34 | message: "Good day!"
35 | left-click:
36 | op: true
37 | command: "weather clear"
38 | lore: "Clear weather"
39 | message: "Sunshine!"
40 | mysterious-amulet:
41 | texture: DIAMOND_HOE:25
42 | name: "Mysterious amulet"
43 | lore:
44 | - "&e&oNobody knows how it works..."
45 | rarity: UNCOMMON
46 | hide-stats: true
47 | stats:
48 | - CRIT_DAMAGE +30-40%
49 | - ARMOR +50%
50 | artifact-of-knowledge:
51 | texture: DIAMOND_HOE:26
52 | name: "Artifact of Knowledge"
53 | lore:
54 | - "&e&oWow, how many new recipes!"
55 | rarity: MYTHICAL
56 | abilities:
57 | permissions:
58 | - rpginventory.craft.journeyman
59 |
--------------------------------------------------------------------------------
/src/main/java/ru/endlesscode/rpginventory/inventory/backpack/BackpackHolder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of RPGInventory.
3 | * Copyright (C) 2015-2017 Osip Fatkullin
4 | *
5 | * RPGInventory is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * RPGInventory is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with RPGInventory. If not, see .
17 | */
18 |
19 | package ru.endlesscode.rpginventory.inventory.backpack;
20 |
21 | import org.bukkit.inventory.Inventory;
22 | import org.bukkit.inventory.InventoryHolder;
23 | import org.jetbrains.annotations.NotNull;
24 |
25 | /**
26 | * Created by OsipXD on 20.11.2015
27 | * It is part of the RpgInventory.
28 | * All rights reserved 2014 - 2016 © «EndlessCode Group»
29 | */
30 | public class BackpackHolder implements InventoryHolder {
31 | private Inventory inventory;
32 |
33 | @NotNull
34 | @Override
35 | public Inventory getInventory() {
36 | return this.inventory;
37 | }
38 |
39 | public void setInventory(Inventory inventory) {
40 | this.inventory = inventory;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/main/java/ru/endlesscode/rpginventory/compat/mimic/RPGInventoryItemsRegistry.java:
--------------------------------------------------------------------------------
1 | package ru.endlesscode.rpginventory.compat.mimic;
2 |
3 | import org.bukkit.Material;
4 | import org.bukkit.inventory.ItemStack;
5 | import org.jetbrains.annotations.NotNull;
6 | import org.jetbrains.annotations.Nullable;
7 | import ru.endlesscode.mimic.items.BukkitItemsRegistry;
8 | import ru.endlesscode.rpginventory.item.CustomItem;
9 | import ru.endlesscode.rpginventory.item.ItemManager;
10 |
11 | import java.util.Collection;
12 |
13 | public class RPGInventoryItemsRegistry implements BukkitItemsRegistry {
14 |
15 | @NotNull
16 | @Override
17 | public Collection getKnownIds() {
18 | return ItemManager.getItemList();
19 | }
20 |
21 | @Nullable
22 | @Override
23 | public ItemStack getItem(@NotNull String itemId, @Nullable Object payload, int amount) {
24 | ItemStack item = ItemManager.getItem(itemId);
25 | if (item.getType() != Material.AIR) {
26 | item.setAmount(amount);
27 | return item;
28 | } else {
29 | return null;
30 | }
31 | }
32 |
33 | @Nullable
34 | @Override
35 | public String getItemId(@NotNull ItemStack item) {
36 | CustomItem customItem = ItemManager.getCustomItem(item);
37 | if (customItem != null) {
38 | return customItem.getId();
39 | } else {
40 | return null;
41 | }
42 | }
43 |
44 | @Override
45 | public boolean isItemExists(@NotNull String itemId) {
46 | return ItemManager.hasItem(itemId);
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/main/java/ru/endlesscode/rpginventory/event/PetUnequipEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of RPGInventory.
3 | * Copyright (C) 2015-2017 Osip Fatkullin
4 | *
5 | * RPGInventory is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * RPGInventory is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with RPGInventory. If not, see .
17 | */
18 |
19 | package ru.endlesscode.rpginventory.event;
20 |
21 | import org.bukkit.entity.Player;
22 | import org.bukkit.event.HandlerList;
23 | import org.bukkit.event.player.PlayerEvent;
24 | import org.jetbrains.annotations.NotNull;
25 |
26 | /**
27 | * Created by OsipXD on 26.08.2015
28 | * It is part of the RpgInventory.
29 | * All rights reserved 2014 - 2016 © «EndlessCode Group»
30 | */
31 | public class PetUnequipEvent extends PlayerEvent {
32 | private static final HandlerList handlers = new HandlerList();
33 |
34 | public PetUnequipEvent(Player player) {
35 | super(player);
36 | }
37 |
38 | @NotNull
39 | @SuppressWarnings("unused")
40 | public static HandlerList getHandlerList() {
41 | return handlers;
42 | }
43 |
44 | @NotNull
45 | public HandlerList getHandlers() {
46 | return handlers;
47 | }
48 | }
--------------------------------------------------------------------------------
/src/main/resources/lang/zh.lang:
--------------------------------------------------------------------------------
1 | #version: 2.0 | Do not remove this line!
2 | title: &b装备菜单
3 |
4 | locked.name: &c未解锁凹槽
5 | locked.lore: &6你必须先解锁上一个凹槽
6 |
7 | buyable.name: &a可用槽
8 | buyable.lore: &6要解锁一个凹槽,你必须:
9 | buyable.money: &6拥有 {0} 金币
10 | buyable.level: &6拥有 {0} 级
11 |
12 | error.fall: &c你无法在飞行中做这个.
13 | error.money: &6你只有 {0} 金币.
14 | error.level: &6你只有 {0} 级.
15 | error.buyable: &6解锁此凹槽需要 {0} 金币. 10秒内再次点击凹槽确认解锁.
16 | error.previous: &6你必须先解锁上一个凹槽
17 | error.rp.denied: &c你必须启用服务器材质包才可进行游戏!
18 | error.item.level: &6需要 &c{0} &6级.
19 | error.item.class: &6你的种族必须为 &c{0}
20 | error.mount.owner: &6坐骑的主人为 {0}
21 | error.creative: &4RPGInventory can''t be used in CREATIVE game mode. Please switch to SURVIVAL.
22 |
23 | message.buyed: &a你成功解锁了一个凹槽!
24 | message.perms: &cYou don''t have permission to use this command
25 |
26 | pet.name: {0} &f[{1}]
27 | pet.health: &c血量: &7{0}
28 | pet.damage: &c伤害: &7{0}
29 | pet.speed: &c移速: &7{0} block/s
30 | pet.revival.yes: &b冷却时间: &7{0}s
31 | pet.revival.no: &b不返回
32 | pet.cooldown: &a&o({0}s)
33 | pet.food.value: &a恢复: {0} HP
34 | pet.role.companion: 同伴
35 | pet.role.mount: 坐骑
36 | mypet.egg: MyPet Egg: {0}
37 |
38 | item.level: &f需要 {0} 级
39 | item.class: &f职业限制: &b{0}
40 | item.nodrop: &7死亡无法掉落
41 | item.left-click: &a左键点击 - {0}
42 | item.right-click: &a右键点击 - {0}
43 | item.hide: &7物品杂项说明已隐藏
44 | item.unbreakable: &7无法破坏
45 |
46 | stat.message.no_bonus: 0
47 | stat.damage: &c附加伤害: &7{0}
48 | stat.bow_damage: &c附加伤害 (弓箭): &7{0}
49 | stat.hand_damage: &c附加伤害 (空手): &7{0}
50 | stat.armor: &3护甲: &7{0}
51 | stat.crit_chance: &6暴击率: &7{0}
52 | stat.crit_damage: &6暴击伤害: &7{0}
53 | stat.speed: &9移速: &7{0}
54 | stat.jump: &9跳跃: &7{0}
55 |
56 | backpack.desc: &8请将背包放入背包凹槽,并右键点击打开
57 | backpack.size: &a容量: &7{0}
58 | backpack.limit: &cYou can''t have more than {0} backpack!
59 |
--------------------------------------------------------------------------------
/src/main/java/ru/endlesscode/rpginventory/utils/CommandUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of RPGInventory.
3 | * Copyright (C) 2015-2017 Osip Fatkullin
4 | *
5 | * RPGInventory is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * RPGInventory is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with RPGInventory. If not, see .
17 | */
18 |
19 | package ru.endlesscode.rpginventory.utils;
20 |
21 | import org.bukkit.Bukkit;
22 | import org.bukkit.entity.Player;
23 | import org.jetbrains.annotations.NotNull;
24 |
25 | /**
26 | * Created by OsipXD on 16.11.2015
27 | * It is part of the RpgInventory.
28 | * All rights reserved 2014 - 2016 © «EndlessCode Group»
29 | */
30 | public class CommandUtils {
31 | /**
32 | * Execute command from player to server
33 | *
34 | * @param player The player
35 | * @param command The command
36 | * @param runFromOp If true, command will be run from OP
37 | */
38 | public static void sendCommand(@NotNull Player player, String command, boolean runFromOp) {
39 | command = StringUtils.setPlaceholders(player, command);
40 |
41 | if (runFromOp) {
42 | Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), command);
43 | } else {
44 | player.performCommand(command);
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/proguard/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | ## Read more about ProGuard configuration:
2 | ## https://www.guardsquare.com/en/products/proguard/manual
3 |
4 | ## You can comment it out to enable obfuscation, but with wrong configuration it can break your plugin
5 | -dontobfuscate
6 | -dontoptimize
7 |
8 | ## Some configurations for obfuscation
9 | #-printmapping out.map
10 | #-keepparameternames
11 | -keepattributes Exceptions,InnerClasses,Signature,Deprecated,SourceFile,LineNumberTable,*Annotation*,EnclosingMethod
12 |
13 | ## Repackage all shadowed classes
14 | #-repackageclasses shadow.ru.endlesscode.rpginventory
15 |
16 | ## We need to keep all plugin's classes.
17 | -keep class ru.endlesscode.rpginventory.*
18 |
19 | ## Keep events listeners
20 | -keep class * implements org.bukkit.event.Listener {
21 | @org.bukkit.event.EventHandler public void *;
22 | }
23 |
24 | -keep class * implements org.bukkit.entity.Entity {
25 | ** getHandle();
26 | }
27 |
28 | ## Rules for Inspector
29 | -keep class * extends org.bukkit.event.Event { org.bukkit.event.HandlerList getHandlerList(); }
30 |
31 | ## Some common rules
32 | -keepclassmembernames class * {
33 | java.lang.Class class$(java.lang.String);
34 | java.lang.Class class$(java.lang.String, boolean);
35 | }
36 |
37 | -keepclasseswithmembernames,includedescriptorclasses class * {
38 | native ;
39 | }
40 |
41 | -keepclassmembers enum * {
42 | public static **[] values();
43 | public static ** valueOf(java.lang.String);
44 | }
45 |
46 | -keepclassmembers class * implements java.io.Serializable {
47 | static final long serialVersionUID;
48 | private static final java.io.ObjectStreamField[] serialPersistentFields;
49 | private void writeObject(java.io.ObjectOutputStream);
50 | private void readObject(java.io.ObjectInputStream);
51 | java.lang.Object writeReplace();
52 | java.lang.Object readResolve();
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/resources/lang/jp.lang:
--------------------------------------------------------------------------------
1 | #version: 2.0 | Do not remove this line!
2 | title: RPG Inventory
3 |
4 | locked.name: &cロックされたのスペース
5 | locked.lore: &6&o以前のロックから解除する必要があります
6 |
7 | buyable.name: &a使用可能なスペース
8 | buyable.lore: &6&oのスペースを購入するには、次の条件:
9 | buyable.money: &6&o• {0} ほどの貨幣が必要である
10 | buyable.level: &6&o• {0} ほどのレベルが必要である
11 |
12 | error.fall: &c空中で使用できません
13 | error.money: &6{0}ほどのお金が必要になります
14 | error.level: &6{0}ほどのレベルが必要です
15 | error.buyable: &6このスペースを購入するには,{0}だけのゴールドが必要になります。購入を確認するため、10秒以内に再度クリックして下さい
16 | error.previous: &6以前スペースのロックを解除する必要があります
17 | error.rp.denied: &cリソースパックを使用に変えてください!
18 | error.item.level: &6それは&c{0}&6レベルが必要になります
19 | error.item.class: &6それはクラスが必要になります &c{0}
20 | error.mount.owner: &6主人に帰属しています {0}
21 | error.creative: &4RPGInventory can''t be used in CREATIVE game mode. Please switch to SURVIVAL.
22 |
23 | message.buyed: &a正常にスペースを購入しました
24 | message.perms: &c権限がありません
25 |
26 | pet.name: {0} &f[{1}]
27 | pet.health: &c健康: &7{0}
28 | pet.damage: &c被害: &7{0}
29 | pet.speed: &c速度: &7{0} block/s
30 | pet.revival.yes: &bクールタイム: &7{0}s
31 | pet.revival.no: &b復活なし
32 | pet.cooldown: &a&o({0}s)
33 | pet.food.value: &a回復: {0} HP
34 | pet.role.companion: ヘルパー
35 | pet.role.mount: 搭乗
36 | mypet.egg: MyPet Egg: {0}
37 |
38 | item.level: &f{0}ほどのレベルが必要になります
39 | item.class: &fそれは&bクラス{0}のみ使用可能です
40 | item.nodrop: &7死んだの後で落とさない
41 | item.left-click: &a左クリック - {0}
42 | item.right-click: &a右クリック - {0}
43 | item.hide: &7&o隠されたアイテム
44 | item.unbreakable: &7耐久
45 |
46 | stat.message.no_bonus: なし
47 | stat.damage: &c被害: &7{0}
48 | stat.bow_damage: &c被害 (弓): &7{0}
49 | stat.hand_damage: &c被害 (手): &7{0}
50 | stat.armor: &3被害減少: &7{0}
51 | stat.crit_chance: &6クリティカル確率: &7{0}
52 | stat.crit_damage: &6クリティカル被害: &7{0}
53 | stat.speed: &9速度: &7{0}
54 | stat.jump: &9ジャンプ: &7{0}
55 |
56 | backpack.desc: &8&o追加のスペースを使用するには、クリックしてください&f右クリック
57 | backpack.size: &aサイズ: &7{0}
58 | backpack.limit: &c所持可能な限度を超えています
59 |
--------------------------------------------------------------------------------
/src/main/resources/lang/kr.lang:
--------------------------------------------------------------------------------
1 | #version: 2.0 | Do not remove this line!
2 | title: 인벤토리
3 |
4 | locked.name: &c잠긴 슬릇
5 | locked.lore: &6&o이전 슬릇부터 해제해야 합니다
6 |
7 | buyable.name: &a구매 가능한 슬릇
8 | buyable.lore: &6&o슬릇을 구입할려면 다음의 조건:
9 | buyable.money: &6• {0} 만큼의 화폐가 필요합니다
10 | buyable.level: &6• {0} 만큼의 레벨이 필요합니다
11 |
12 | error.fall: &c공중에서 사용할 수 없습니다
13 | error.money: &6{0} 만큼의 돈이 더 필요합니다
14 | error.level: &6{0} 만큼의 레벨이 더 필요합니다
15 | error.buyable: &6당신이 이 슬릇을 구입할려면 {0} 만큼의 골드가 필요합니다. 구입 확인을 위해 10 초 이내로 다시 클릭해주시길 바랍니다.
16 | error.previous: &6이전 슬릇의 잠금을 해제해야 합니다
17 | error.rp.denied: &c리소스 팩이 필요합니다!
18 | error.item.level: &6그것은 &c{0} &6레벨이 필요합니다
19 | error.item.class: &6그것은 클래스가 필요합니다 &c{0}
20 | error.mount.owner: &6주인에게 귀속되어 있습니다 {0}
21 | error.creative: &4RPGInventory can''t be used in CREATIVE game mode. Please switch to SURVIVAL.
22 |
23 | message.buyed: &a성공적으로 슬릇을 구입했습니다
24 | message.perms: &c권한이 없습니다
25 |
26 | pet.name: {0} &f[{1}]
27 | pet.health: &c체력: &7{0}
28 | pet.damage: &c데미지: &7{0}
29 | pet.speed: &c스피드: &7{0} block/s
30 | pet.revival.yes: &b쿨타임: &7{0}s
31 | pet.revival.no: &b부활하지 않습니다
32 | pet.cooldown: &a&o({0}s)
33 | pet.food.value: &a회복: {0} HP
34 | pet.role.companion: 도우미
35 | pet.role.mount: 탑승
36 | mypet.egg: MyPet Egg: {0}
37 |
38 | item.level: &f{0} 레벨이 필요합니다
39 | item.class: &f그것은 &b{0} 클래스만 사용이 가능합니다
40 | item.nodrop: &7죽을 때 떨어트리지 않습니다
41 | item.left-click: &a왼 클릭 - {0}
42 | item.right-click: &a우 클릭 - {0}
43 | item.hide: &7알 수 없음
44 | item.unbreakable: &7내구성
45 |
46 | stat.message.no_bonus: 없음
47 | stat.damage: &c데미지: &7{0}
48 | stat.bow_damage: &c데미지 (활): &7{0}
49 | stat.hand_damage: &c데미지 (손): &7{0}
50 | stat.armor: &3피해 감소: &7{0}
51 | stat.crit_chance: &6크리티컬 확률: &7{0}
52 | stat.crit_damage: &6크리티컬 데미지: &7{0}
53 | stat.speed: &9스피드: &7{0}
54 | stat.jump: &9도약: &7{0}
55 |
56 | backpack.desc: &8&o추가 슬릇을 사용할려면 클릭하세요 &f우클릭
57 | backpack.size: &a크기: &7{0}
58 | backpack.limit: &c소유 가능한 한도를 초과하였습니다
59 |
--------------------------------------------------------------------------------
/src/main/java/ru/endlesscode/rpginventory/event/listener/WorldListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of RPGInventory.
3 | * Copyright (C) 2015-2017 Osip Fatkullin
4 | *
5 | * RPGInventory is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * RPGInventory is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with RPGInventory. If not, see .
17 | */
18 |
19 | package ru.endlesscode.rpginventory.event.listener;
20 |
21 | import org.bukkit.Bukkit;
22 | import org.bukkit.entity.Player;
23 | import org.bukkit.event.EventHandler;
24 | import org.bukkit.event.Listener;
25 | import org.bukkit.event.world.WorldSaveEvent;
26 | import org.jetbrains.annotations.NotNull;
27 | import ru.endlesscode.rpginventory.inventory.InventoryManager;
28 | import ru.endlesscode.rpginventory.inventory.backpack.BackpackManager;
29 |
30 | /**
31 | * Created by OsipXD on 24.11.2015
32 | * It is part of the RpgInventory.
33 | * All rights reserved 2014 - 2016 © «EndlessCode Group»
34 | */
35 | public class WorldListener implements Listener {
36 | @EventHandler
37 | public void onWorldSave(@NotNull WorldSaveEvent event) {
38 | if (!event.getWorld().equals(Bukkit.getWorlds().get(0))) {
39 | return;
40 | }
41 |
42 | BackpackManager.saveBackpacks();
43 |
44 | for (Player player : Bukkit.getServer().getOnlinePlayers()) {
45 | InventoryManager.savePlayerInventory(player);
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/gradle/publish.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: "maven-publish"
2 | apply plugin: "com.jfrog.bintray"
3 |
4 | java {
5 | withSourcesJar()
6 | }
7 |
8 | publishing {
9 | publications {
10 | "maven"(MavenPublication) { publication ->
11 | from(components.java)
12 | }
13 | "shadow"(MavenPublication) { publication ->
14 | project.shadow.component(publication)
15 | }
16 | }
17 | }
18 |
19 | def repoUrl = "https://github.com/EndlessCodeGroup/RPGInventory"
20 | def pluginName = "RPGInventory"
21 | def bintrayUsername = System.getProperty("bintray.username") ?: System.getenv("BINTRAY_USERNAME")
22 | def bintrayApiKey = System.getProperty("bintray.apiKey") ?: System.getenv("BINTRAY_API_KEY")
23 | if (bintrayUsername == null || bintrayApiKey == null) {
24 | println("""
25 | System properties 'bintray.username' and 'bintray.apiKey' are not specified.
26 | Publication to Bintray is unavailable.
27 | Alternatively, you can specify environment variables 'BINTRAY_USERNAME' and 'BINTRAY_API_KEY'.
28 | https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_system_properties
29 | """.stripIndent())
30 | return
31 | }
32 |
33 | bintray {
34 | user = bintrayUsername
35 | key = bintrayApiKey
36 | setPublications("maven", "shadow")
37 |
38 | pkg {
39 | repo = "repo"
40 | name = pluginName.toLowerCase()
41 | userOrg = "endlesscode"
42 | setLicenses("GPL-3.0-or-later")
43 | setLabels("plugin", "bukkit", "rpg", "minecraft")
44 | publicDownloadNumbers = true
45 | vcsUrl = "${repoUrl}.git"
46 | websiteUrl = repoUrl
47 | issueTrackerUrl = "$repoUrl/issues"
48 |
49 | version {
50 | name = project.version.toString()
51 | desc = "$pluginName v$name"
52 | released = new Date().toString()
53 | vcsTag = "v$name"
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/main/java/ru/endlesscode/rpginventory/inventory/backpack/BackpackUpdater.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of RPGInventory.
3 | * Copyright (C) 2015-2017 Osip Fatkullin
4 | *
5 | * RPGInventory is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * RPGInventory is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with RPGInventory. If not, see .
17 | */
18 |
19 | package ru.endlesscode.rpginventory.inventory.backpack;
20 |
21 | import org.bukkit.inventory.Inventory;
22 | import org.bukkit.scheduler.BukkitRunnable;
23 | import ru.endlesscode.rpginventory.RPGInventory;
24 |
25 | import java.util.Arrays;
26 |
27 | /**
28 | * Created by OsipXD on 26.08.2016
29 | * It is part of the RpgInventory.
30 | * All rights reserved 2014 - 2016 © «EndlessCode Group»
31 | */
32 | public class BackpackUpdater extends BukkitRunnable {
33 | private final Inventory inventory;
34 | private final Backpack backpack;
35 |
36 | private static final int DELAY = 2;
37 |
38 | private BackpackUpdater(Inventory inventory, Backpack backpack) {
39 | this.inventory = inventory;
40 | this.backpack = backpack;
41 | }
42 |
43 | public static void update(Inventory inventory, Backpack backpack) {
44 | new BackpackUpdater(inventory, backpack).runTaskLater(RPGInventory.getInstance(), DELAY);
45 | }
46 |
47 | @Override
48 | public void run() {
49 | backpack.onUse();
50 |
51 | int backpackSize = backpack.getType().getSize();
52 | backpack.setContents(Arrays.copyOfRange(inventory.getContents(), 0, backpackSize));
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/ru/endlesscode/rpginventory/event/PlayerInventoryUnloadEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of RPGInventory.
3 | * Copyright (C) 2015-2017 Osip Fatkullin
4 | *
5 | * RPGInventory is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * RPGInventory is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with RPGInventory. If not, see .
17 | */
18 |
19 | package ru.endlesscode.rpginventory.event;
20 |
21 | import org.bukkit.entity.Player;
22 | import org.bukkit.event.HandlerList;
23 | import org.bukkit.event.player.PlayerEvent;
24 | import org.jetbrains.annotations.NotNull;
25 |
26 | /**
27 | * Created by OsipXD on 11.09.2015
28 | * It is part of the RpgInventory.
29 | * All rights reserved 2014 - 2016 © «EndlessCode Group»
30 | */
31 | public class PlayerInventoryUnloadEvent extends PlayerEvent {
32 | private static final HandlerList handlers = new HandlerList();
33 |
34 | private PlayerInventoryUnloadEvent(Player who) {
35 | super(who);
36 | }
37 |
38 | @NotNull
39 | @SuppressWarnings("unused")
40 | public static HandlerList getHandlerList() {
41 | return handlers;
42 | }
43 |
44 | @NotNull
45 | @Override
46 | public HandlerList getHandlers() {
47 | return handlers;
48 | }
49 |
50 | @SuppressWarnings("unused")
51 | private static class Pre extends PlayerInventoryUnloadEvent {
52 | public Pre(Player who) {
53 | super(who);
54 | }
55 | }
56 |
57 | public static class Post extends PlayerInventoryUnloadEvent {
58 | public Post(Player who) {
59 | super(who);
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/src/main/java/ru/endlesscode/rpginventory/utils/FileUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of RPGInventory.
3 | * Copyright (C) 2015-2017 Osip Fatkullin
4 | *
5 | * RPGInventory is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * RPGInventory is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with RPGInventory. If not, see .
17 | */
18 |
19 | package ru.endlesscode.rpginventory.utils;
20 |
21 | import org.jetbrains.annotations.NotNull;
22 |
23 | import java.io.IOException;
24 | import java.nio.file.Files;
25 | import java.nio.file.Path;
26 | import java.nio.file.StandardCopyOption;
27 |
28 | /**
29 | * Created by OsipXD on 07.12.2015
30 | * It is part of the RpgInventory.
31 | * All rights reserved 2014 - 2016 © «EndlessCode Group»
32 | */
33 | public class FileUtils {
34 |
35 | @NotNull
36 | public static String stripExtension(String fileName) {
37 | return fileName.substring(0, fileName.lastIndexOf('.'));
38 | }
39 |
40 | public static void resolveException(Path path) {
41 | try {
42 | final byte[] bytes = Files.readAllBytes(path);
43 | boolean isAllBytesAreZero = true;
44 | for (byte b : bytes) {
45 | if (b != 0) {
46 | isAllBytesAreZero = false;
47 | break;
48 | }
49 | }
50 |
51 | String newFileName = path.getFileName().toString().concat(isAllBytesAreZero ? ".gone" : ".broken");
52 | Files.move(path, path.getParent().resolve(newFileName), StandardCopyOption.REPLACE_EXISTING);
53 | } catch (IOException ignored) {
54 | }
55 | }
56 |
57 | }
58 |
--------------------------------------------------------------------------------
/src/main/java/ru/endlesscode/rpginventory/item/ItemAction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of RPGInventory.
3 | * Copyright (C) 2015-2017 Osip Fatkullin
4 | *
5 | * RPGInventory is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * RPGInventory is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with RPGInventory. If not, see .
17 | */
18 |
19 | package ru.endlesscode.rpginventory.item;
20 |
21 | import org.bukkit.configuration.ConfigurationSection;
22 | import org.bukkit.entity.Player;
23 | import org.jetbrains.annotations.NotNull;
24 | import ru.endlesscode.rpginventory.utils.CommandUtils;
25 | import ru.endlesscode.rpginventory.utils.PlayerUtils;
26 | import ru.endlesscode.rpginventory.utils.StringUtils;
27 |
28 | /**
29 | * Created by OsipXD on 12.04.2016
30 | * It is part of the RpgInventory.
31 | * All rights reserved 2014 - 2016 © «EndlessCode Group»
32 | */
33 | class ItemAction {
34 | private final String command;
35 | private final String caption;
36 | private final String message;
37 | private final boolean asOp;
38 |
39 | ItemAction(@NotNull ConfigurationSection config) {
40 | this.command = config.getString("command");
41 | this.caption = config.getString("lore");
42 | this.message = config.getString("message");
43 | this.asOp = config.getBoolean("op", false);
44 | }
45 |
46 | void doAction(Player player) {
47 | CommandUtils.sendCommand(player, command, asOp);
48 | if (message != null) {
49 | PlayerUtils.sendMessage(player, StringUtils.coloredLine(message));
50 | }
51 | }
52 |
53 | public String getCaption() {
54 | return caption;
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/main/resources/lang/rs.lang:
--------------------------------------------------------------------------------
1 | #version: 2.0 | Do not remove this line!
2 | title: RPG Inventory
3 |
4 | locked.name: &cZakljucan slot
5 | locked.lore: &6Moras prvo da otkljucas prethodni slot!
6 |
7 | buyable.name: &aDostupan slot
8 | buyable.lore: &6Da kupis slot moras imati:
9 | buyable.money: &6 {0} para
10 | buyable.level: &6 {0} lvl
11 |
12 | error.fall: &cNe mozes to raditi dok letis!
13 | error.money: &6Da kupis ovaj slot moras imati &e{0} &6para
14 | error.level: &6Da kupis ovaj slot moras imati&e {0} &6lvl
15 | error.buyable: &6Da kupis ovaj slot moras imati {0} para. Klikni u narednih 10 sekundi da potvrdis!
16 | error.previous: &6Prvo odkljucaj prethodni slot!
17 | error.rp.denied: &cMoras dozvoliti skidanje teksture!
18 | error.item.level: &6Potrebno &c{0} &6levela
19 | error.item.class: &6Potrebna klasa &c{0}
20 | error.mount.owner: &6Mount je od {0}
21 | error.creative: &4RPGInventory can''t be used in CREATIVE game mode. Please switch to SURVIVAL.
22 |
23 | message.buyed: &aUspesno ste kupili slot
24 | message.perms: &cYou don''t have permission to use this command
25 |
26 | pet.name: &6{0} &7[&b{1}&7]
27 | pet.health: &cZivoti: &7{0}
28 | pet.damage: &cUdarac: &7{0}
29 | pet.speed: &cBrzina: &7{0} block/s
30 | pet.revival.yes: &bCooldown: &7{0}s
31 | pet.revival.no: &bDon''t revives
32 | pet.cooldown: &a({0}s)
33 | pet.food.value: &aPunjenje: {0} HP
34 | pet.role.companion: Pratilac
35 | pet.role.mount: Mount
36 | mypet.egg: MyPet Egg: {0}
37 |
38 | item.level: &fPotrebno {0} level
39 | item.class: &fSamo za &b{0}
40 | item.nodrop: &7Ne gubi se na smrti
41 | item.left-click: &aLevi klik - {0}
42 | item.right-click: &aDesni klik - {0}
43 | item.hide: &7Statusi itema su sakriveni
44 | item.unbreakable: &7Neunistivi item
45 |
46 | stat.message.no_bonus: No bonus
47 | stat.damage: &cDamage: &7{0}
48 | stat.bow_damage: &cDamage (shoot): &7{0}
49 | stat.hand_damage: &cDamage (hand): &7{0}
50 | stat.armor: &3Armor: &7{0}
51 | stat.crit_chance: &6Crit Chance: &7{0}
52 | stat.crit_damage: &6Crit Damage: &7{0}
53 | stat.speed: &9Speed: &7{0}
54 | stat.jump: &9Jump: &7{0}
55 |
56 | backpack.desc: &8&oPut it in specified slot and click &fRMB
57 | backpack.size: &aSize: &7{0}
58 | backpack.limit: &cYou can''t have more than {0} backpack!
59 |
--------------------------------------------------------------------------------
/src/main/java/ru/endlesscode/rpginventory/utils/SafeEnums.java:
--------------------------------------------------------------------------------
1 | package ru.endlesscode.rpginventory.utils;
2 |
3 | import org.bukkit.DyeColor;
4 | import org.bukkit.entity.Cat;
5 | import org.bukkit.entity.Horse;
6 | import org.jetbrains.annotations.NotNull;
7 | import org.jetbrains.annotations.Nullable;
8 |
9 | import java.util.Arrays;
10 |
11 | public class SafeEnums {
12 |
13 | private SafeEnums() {
14 | // Shouldn't be instantiated
15 | }
16 |
17 | @Nullable
18 | public static DyeColor getDyeColor(String name) {
19 | return valueOf(DyeColor.class, name, "color");
20 | }
21 |
22 | @Nullable
23 | public static Horse.Color getHorseColor(String name) {
24 | return valueOf(Horse.Color.class, name, "horse color");
25 | }
26 |
27 | @Nullable
28 | public static Horse.Style getHorseStyle(String name) {
29 | return valueOf(Horse.Style.class, name, "horse style");
30 | }
31 |
32 | @Nullable
33 | public static Cat.Type getCatType(String name) {
34 | return valueOf(Cat.Type.class, name, "cat type");
35 | }
36 |
37 | @NotNull
38 | public static > T valueOfOrDefault(Class enumClass, String name, T defaultValue) {
39 | return valueOfOrDefault(enumClass, name, defaultValue, enumClass.getSimpleName());
40 | }
41 |
42 | @NotNull
43 | public static > T valueOfOrDefault(Class enumClass, String name, T defaultValue, String alias) {
44 | T value = valueOf(enumClass, name, alias);
45 | if (value != null) {
46 | return value;
47 | } else {
48 | Log.w("Used {0} {1} by default.", defaultValue.name(), alias);
49 | return defaultValue;
50 | }
51 | }
52 |
53 | @Nullable
54 | public static > T valueOf(Class enumClass, String name, String alias) {
55 | if (name == null) {
56 | return null;
57 | }
58 |
59 | try {
60 | return Enum.valueOf(enumClass, name.toUpperCase());
61 | } catch (IllegalArgumentException e) {
62 | Log.w("Unknown {0}: {1}. Available values: {2}", alias, name, Arrays.toString(enumClass.getEnumConstants()));
63 | return null;
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/src/test/java/ru/endlesscode/rpginventory/utils/LogTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of RPGInventory.
3 | * Copyright (C) 2018 EndlessCode Group and contributors
4 | *
5 | * RPGInventory is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * RPGInventory is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with RPGInventory. If not, see .
17 | */
18 |
19 | package ru.endlesscode.rpginventory.utils;
20 |
21 | import org.junit.BeforeClass;
22 | import org.junit.Test;
23 | import org.mockito.Mockito;
24 |
25 | import java.util.logging.Level;
26 | import java.util.logging.Logger;
27 |
28 | public class LogTest {
29 |
30 | private static final Logger logger = Mockito.mock(Logger.class);
31 |
32 | @BeforeClass
33 | public static void init() {
34 | Log.init(logger);
35 | }
36 |
37 | @Test
38 | public void shouldApplyArgsToMessage() {
39 | Exception exception = new Exception("Exception message");
40 |
41 | Log.i("Info {0}, {1}", 0, "arg1");
42 | Mockito.verify(logger).info("Info 0, arg1");
43 |
44 | Log.w(exception);
45 | Mockito.verify(logger).log(Level.WARNING, "Exception message", exception);
46 |
47 | Log.w("Warning {0}, {1}", 0, "arg1");
48 | Mockito.verify(logger).warning("Warning 0, arg1");
49 |
50 | Log.w(exception, "Warning {0}, {1}", 0, "arg1");
51 | Mockito.verify(logger).log(Level.WARNING, "Warning 0, arg1", exception);
52 |
53 | Log.s("Severe {0}, {1}", 0, "arg1");
54 | Mockito.verify(logger).severe("Severe 0, arg1");
55 | }
56 |
57 | @Test
58 | public void shouldApplyArgsToMessageWithQuotes() {
59 | Log.i("Info ''{0}'', \"{1}\"", "q", "qq");
60 | Mockito.verify(logger).info("Info 'q', \"qq\"");
61 | }
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/src/main/resources/lang/en.lang:
--------------------------------------------------------------------------------
1 | #version: 2.0 | Do not remove this line!
2 | title: RPG Inventory
3 |
4 | locked.name: &cLocked slot
5 | locked.lore: &6&oYou need to unlock the previous slots first
6 |
7 | buyable.name: &aAvailable slot
8 | buyable.lore: &6&oTo purchase a slot, you must:
9 | buyable.money: &6&o• Have {0} gold
10 | buyable.level: &6&o• Be {0} lvl
11 |
12 | error.fall: &cYou can''t do it while you are flying
13 | error.money: &6To purchase slots you still need {0} gold
14 | error.level: &6To purchase slots you need {0} lvl
15 | error.buyable: &6To purchase this slots you need {0} gold. Click on it again in the next 10 seconds to confirm the purchase.
16 | error.previous: &6First unlock previous slots
17 | error.rp.denied: &cYou must allow downloading the resource-pack!
18 | error.item.level: &6Required &c{0} &6level
19 | error.item.class: &6Required class &c{0}
20 | error.mount.owner: &6Mount belongs to {0}
21 | error.creative: &4RPGInventory can''t be used in CREATIVE game mode. Please switch to SURVIVAL.
22 |
23 | message.buyed: &aYou have successfully purchased the slot
24 | message.perms: &cYou don''t have permission to use this command
25 |
26 | pet.name: {0} &f[{1}]
27 | pet.health: &cHealth: &7{0}
28 | pet.damage: &cDamage: &7{0}
29 | pet.speed: &cSpeed: &7{0} block/s
30 | pet.revival.yes: &bCooldown: &7{0}s
31 | pet.revival.no: &bDon''t revives
32 | pet.cooldown: &a&o({0}s)
33 | pet.food.value: &aRestores: {0} HP
34 | pet.role.companion: Companion
35 | pet.role.mount: Mount
36 | mypet.egg: MyPet Egg: {0}
37 |
38 | item.level: &fRequires {0} level
39 | item.class: &fOnly for &b{0}
40 | item.nodrop: &7Doesn''t drop on death
41 | item.left-click: &aLMB - {0}
42 | item.right-click: &aRMB - {0}
43 | item.hide: &7&oItem stats are hidden
44 | item.unbreakable: &7Unbreakable item
45 |
46 | stat.message.no_bonus: No bonus
47 | stat.damage: &cDamage: &7{0}
48 | stat.bow_damage: &cDamage (shoot): &7{0}
49 | stat.hand_damage: &cDamage (hand): &7{0}
50 | stat.armor: &3Armor: &7{0}
51 | stat.crit_chance: &6Crit Chance: &7{0}
52 | stat.crit_damage: &6Crit Damage: &7{0}
53 | stat.speed: &9Speed: &7{0}
54 | stat.jump: &9Jump: &7{0}
55 |
56 | backpack.desc: &8&oPut it in specified slot and click &fRMB
57 | backpack.size: &aSize: &7{0}
58 | backpack.limit: &cYou can''t have more than {0} backpack!
59 |
--------------------------------------------------------------------------------
/src/main/java/ru/endlesscode/rpginventory/event/PetEquipEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of RPGInventory.
3 | * Copyright (C) 2015-2017 Osip Fatkullin
4 | *
5 | * RPGInventory is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * RPGInventory is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with RPGInventory. If not, see .
17 | */
18 |
19 | package ru.endlesscode.rpginventory.event;
20 |
21 | import org.bukkit.entity.Player;
22 | import org.bukkit.event.Cancellable;
23 | import org.bukkit.event.HandlerList;
24 | import org.bukkit.event.player.PlayerEvent;
25 | import org.bukkit.inventory.ItemStack;
26 | import org.jetbrains.annotations.NotNull;
27 |
28 | /**
29 | * Created by OsipXD on 26.08.2015
30 | * It is part of the RpgInventory.
31 | * All rights reserved 2014 - 2016 © «EndlessCode Group»
32 | */
33 | public class PetEquipEvent extends PlayerEvent implements Cancellable {
34 | private static final HandlerList handlers = new HandlerList();
35 | private final ItemStack petItem;
36 |
37 | private boolean cancelled;
38 |
39 | public PetEquipEvent(Player player, ItemStack petItem) {
40 | super(player);
41 | this.petItem = petItem;
42 | }
43 |
44 | @NotNull
45 | @SuppressWarnings("unused")
46 | public static HandlerList getHandlerList() {
47 | return handlers;
48 | }
49 |
50 | public ItemStack getPetItem() {
51 | return petItem;
52 | }
53 |
54 | @NotNull
55 | @Override
56 | public HandlerList getHandlers() {
57 | return handlers;
58 | }
59 |
60 | @Override
61 | public boolean isCancelled() {
62 | return this.cancelled;
63 | }
64 |
65 | @Override
66 | public void setCancelled(boolean cancelled) {
67 | this.cancelled = cancelled;
68 | }
69 | }
70 |
71 |
72 |
--------------------------------------------------------------------------------
/src/main/resources/lang/cs.lang:
--------------------------------------------------------------------------------
1 | #version: 2.0 | Do not remove this line!
2 | title: RPG Inventar
3 |
4 | locked.name: &cZamceny slot
5 | locked.lore: &6&oNejdrive musis odemknout predchozi slot
6 |
7 | buyable.name: &aDostupny slot
8 | buyable.lore: &6&oAby si odemkl slot musis:
9 | buyable.money: &6&o• mit {0} goldu
10 | buyable.level: &6&o• byt {0} lvl
11 |
12 | error.fall: &cYou can''t do it while you are flying
13 | error.money: &6Aby si mohl odemknout slot jeste potrebujes {0} gold
14 | error.level: &6Aby si mohl odemknout slot potrebujes {0} lvlu
15 | error.buyable: &6Odemknuti tohoto slotu te bude stat {0} gold. Klikni na to znova do 10 vterin aby si potvrdil odemceni.
16 | error.previous: &6Nejdrive odemkni predchozi sloty
17 | error.rp.denied: &cMusis povolit stazeni resource-packu!
18 | error.item.level: &6Vyzaduje &c{0} &6level
19 | error.item.class: &6Vyzaduje tridu &c{0}
20 | error.mount.owner: &6Zvire patri %
21 | error.creative: &4RPGInventory can''t be used in CREATIVE game mode. Please switch to SURVIVAL.
22 |
23 | message.buyed: &aUspesne jsi zakoupil slot
24 | message.perms: &cYou don''t have permission to use this command
25 |
26 | pet.name: {0} &f[{1}]
27 | pet.health: &cZivoty: &7{0}
28 | pet.damage: &cUtok: &7{0}
29 | pet.speed: &cRychlost: &7{0} block/s
30 | pet.revival.yes: &bOzivovaci doba: &7{0}s
31 | pet.revival.no: &bNeozivuje se
32 | pet.cooldown: &a&o({0}s)
33 | pet.food.value: &aObnovi: {0} Zivota
34 | pet.role.companion: Spolecnik
35 | pet.role.mount: Jezdec
36 | mypet.egg: MyPet Egg: {0}
37 |
38 | item.level: &fVyzaduje {0} level
39 | item.class: &fJen pro &b{0}
40 | item.nodrop: &7Nevypadne pri smrti
41 | item.left-click: &aLMB - {0}
42 | item.right-click: &aRMB - {0}
43 | item.hide: &7&oItem stats are hidden
44 | item.unbreakable: &7Unbreakable item
45 |
46 | stat.message.no_bonus: No bonus
47 | stat.damage: &cUtok: &7{0}
48 | stat.bow_damage: &cUtok (na dalku): &7{0}
49 | stat.hand_damage: &cUtok (na blizko): &7{0}
50 | stat.armor: &3Brneni: &7{0}
51 | stat.crit_chance: &6Sance na kriticky utok: &7{0}
52 | stat.crit_damage: &6Poskozeni kritickym utokem: &7{0}
53 | stat.speed: &9Rychlost: &7{0}
54 | stat.jump: &9Skoky: &7{0}
55 |
56 | backpack.desc: &8&oPrendej ho do spravneho slotu v RPG inventari
57 | backpack.size: &aKapacita: &7{0}
58 | backpack.limit: &cYou can''t have more than {0} backpack!
59 |
--------------------------------------------------------------------------------
/src/main/resources/lang/tr.lang:
--------------------------------------------------------------------------------
1 | #version: 2.0 | Do not remove this line!
2 | title: RPG Envanteri
3 |
4 | locked.name: &cKilitli Bölme
5 | locked.lore: &6&oÖnce bir önceki bölmeyi alman gerek
6 |
7 | buyable.name: &aMevcut Bölmeler
8 | buyable.lore: &6&oBunu alabilmek için, bunlara sahip olmalısın:
9 | buyable.money: &6&o• {0} Altın
10 | buyable.level: &6&o• {0} Seviye
11 |
12 | error.fall: &cUçarken bunu yapamazsın
13 | error.money: &6Bunu alabilmek için {0} altına ihtiyacin var
14 | error.level: &6Bunu alabilmek için {0} seviyeye ihtiyacın var
15 | error.buyable: &6Bu slotu alabilmek için {0} altına ihtiyacın olacak! 10 saniye içinde tekrar tıklarsan satın almayı onaylarsın.
16 | error.previous: &6İlk olarak önceki sekmeyi açman gerek!
17 | error.rp.denied: &cKaynak paketi yüklemeyi devreye sokman gerek!
18 | error.item.level: &c{0} &6Seviye lazım!
19 | error.item.class: &6Gereken Irk: &c{0}
20 | error.mount.owner: &6Bineğin sahibi {0}
21 | error.creative: &4RPGInventory can''t be used in CREATIVE game mode. Please switch to SURVIVAL.
22 |
23 | message.buyed: &aBu bölmeyi başarıyla aldın!
24 | message.perms: &cYou don''t have permission to use this command
25 |
26 | pet.name: {0} &f[{1}]
27 | pet.health: &cCan: &7{0}
28 | pet.damage: &cHasar: &7{0}
29 | pet.speed: &cHız: &7{0} blok/saniye
30 | pet.revival.yes: &bBekleme Süresi: &7{0}s
31 | pet.revival.no: &bCanlandırma Yok!
32 | pet.cooldown: &a&o({0}s)
33 | pet.food.value: &aYenileme: {0} Can
34 | pet.role.companion: Yoldaş
35 | pet.role.mount: Binek
36 | mypet.egg: MyPet Egg: {0}
37 |
38 | item.level: &f{0} Seviye gerektirir!
39 | item.class: &b{0} &fIrkına özel!
40 | item.nodrop: &7Ölünce eşya düşmez!
41 | item.left-click: &aSol Tıkla - {0}
42 | item.right-click: &aSağ Tıkla - {0}
43 | item.hide: &7&oEşya istatistikleri gizlendi
44 | item.unbreakable: &7Kırılmaz eşya
45 |
46 | stat.message.no_bonus: Bonus yok
47 | stat.damage: &cHasar: &7{0}
48 | stat.bow_damage: &cHasar: (Vurus): &7{0}
49 | stat.hand_damage: &cHasar: (El): &7{0}
50 | stat.armor: &3Zırh: &7{0}
51 | stat.crit_chance: &6Kritik şansı: &7{0}
52 | stat.crit_damage: &6Kritik hasarı: &7{0}
53 | stat.speed: &9Hız: &7{0}
54 | stat.jump: &9Zıplama: &7{0}
55 |
56 | backpack.desc: &8&oBelirtilen bölmeye koyup &fSağ tuşa &8tikla!
57 | backpack.size: &aBoyut: &7{0}
58 | backpack.limit: &cYou can''t have more than {0} backpack!
59 |
--------------------------------------------------------------------------------
/src/main/java/ru/endlesscode/rpginventory/inventory/ActionType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of RPGInventory.
3 | * Copyright (C) 2015-2017 Osip Fatkullin
4 | *
5 | * RPGInventory is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * RPGInventory is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with RPGInventory. If not, see .
17 | */
18 |
19 | package ru.endlesscode.rpginventory.inventory;
20 |
21 | import org.bukkit.event.inventory.InventoryAction;
22 | import org.jetbrains.annotations.Contract;
23 | import org.jetbrains.annotations.NotNull;
24 |
25 | /**
26 | * Created by OsipXD on 09.04.2016
27 | * It is part of the RpgInventory.
28 | * All rights reserved 2014 - 2016 © «EndlessCode Group»
29 | */
30 | public enum ActionType {
31 | SET,
32 | GET,
33 | DROP,
34 | OTHER;
35 |
36 | @NotNull
37 | @Contract(pure = true)
38 | public static ActionType getTypeOfAction(InventoryAction action) {
39 | if (action == InventoryAction.PLACE_ALL || action == InventoryAction.PLACE_ONE
40 | || action == InventoryAction.PLACE_SOME || action == InventoryAction.SWAP_WITH_CURSOR) {
41 | return SET;
42 | }
43 |
44 | if (action == InventoryAction.MOVE_TO_OTHER_INVENTORY || action == InventoryAction.PICKUP_ALL
45 | || action == InventoryAction.PICKUP_ONE || action == InventoryAction.PICKUP_SOME
46 | || action == InventoryAction.PICKUP_HALF || action == InventoryAction.COLLECT_TO_CURSOR) {
47 | return GET;
48 | }
49 |
50 | if (action == InventoryAction.DROP_ALL_CURSOR || action == InventoryAction.DROP_ALL_SLOT
51 | || action == InventoryAction.DROP_ONE_CURSOR || action == InventoryAction.DROP_ONE_SLOT) {
52 | return DROP;
53 | }
54 |
55 | return OTHER;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/main/java/ru/endlesscode/rpginventory/utils/Log.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of RPGInventory.
3 | * Copyright (C) 2018 EndlessCode Group and contributors
4 | *
5 | * RPGInventory is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * RPGInventory is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with RPGInventory. If not, see .
17 | */
18 |
19 | package ru.endlesscode.rpginventory.utils;
20 |
21 | import org.jetbrains.annotations.NotNull;
22 |
23 | import java.text.MessageFormat;
24 | import java.util.logging.Level;
25 | import java.util.logging.Logger;
26 |
27 | @SuppressWarnings("CheckStyle")
28 | public final class Log {
29 |
30 | private static Logger logger;
31 |
32 | private Log() {
33 | // static class
34 | }
35 |
36 | public static void init(@NotNull Logger logger) {
37 | Log.logger = logger;
38 | }
39 |
40 | public static void i(@NotNull String message, Object... args) {
41 | logger.info(prepareMessage(message, args));
42 | }
43 |
44 | public static void w(Throwable t) {
45 | logger.log(Level.WARNING, t.getMessage(), t);
46 | }
47 |
48 | public static void w(@NotNull String message, Object... args) {
49 | logger.warning(prepareMessage(message, args));
50 | }
51 |
52 | public static void w(Throwable t, @NotNull String message, Object... args) {
53 | logger.log(Level.WARNING, prepareMessage(message, args), t);
54 | }
55 |
56 | public static void d(Throwable t) {
57 | logger.log(Level.FINE, "", t);
58 | }
59 |
60 | public static void s(@NotNull String message, Object... args) {
61 | logger.severe(prepareMessage(message, args));
62 | }
63 |
64 | private static String prepareMessage(String message, Object... args) {
65 | return MessageFormat.format(message, args);
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/src/main/resources/lang/ru.lang:
--------------------------------------------------------------------------------
1 | #version: 2.0 | Do not remove this line!
2 | title: RPG Inventory
3 |
4 | locked.name: &cЗаблокированный слот
5 | locked.lore: &6&oСначала разблокируйте предыдущие слоты
6 |
7 | buyable.name: &aДоступный слот
8 | buyable.lore: &6&oЧтобы приобрести слот, нужно:
9 | buyable.money: &6&o• Иметь {0} золота
10 | buyable.level: &6&o• Быть {0} уровня
11 |
12 | error.fall: &6Нельзя изменять этот слот, пока вы в полёте
13 | error.money: &6Для покупки слота не хватает {0} золота
14 | error.level: &6Для покупки слота нужен {0} уровень
15 | error.buyable: &6Этот слот стоит {0} золота, чтобы подтвердить его покупку, нажмите на него еще раз в течение 10 секунд
16 | error.previous: &6Сначала разблокируйте предыдущие слоты
17 | error.rp.denied: &cДля игры на сервере нужно cогласиться на загрузку текстур!
18 | error.item.level: &6Требуется &c{0} &6уровень
19 | error.item.class: &6Требуется класс &c{0}
20 | error.mount.owner: &6Скакун принадлежит {0}
21 | error.creative: &4RPGInventory нельзя использовать в режиме CREATIVE. Пожалуйста, переключитесь в SURVIVAL.
22 |
23 | message.buyed: &aВы успешно приобрели слот
24 | message.perms: &cУ вас нет прав на использование этой команды
25 |
26 | pet.name: {0} &f[{1}]
27 | pet.health: &cЗдоровье: &7{0}
28 | pet.damage: &cУрон: &7{0}
29 | pet.speed: &cСкорость: &7{0} блок./сек
30 | pet.revival.yes: &bВремя возрождения: &7{0}с
31 | pet.revival.no: &bНе возрождается
32 | pet.cooldown: &a&o({0}с)
33 | pet.food.value: &aВосстанавливает: {0} HP
34 | pet.role.companion: Компаньон
35 | pet.role.mount: Ездовое животное
36 | mypet.egg: Яйцо призыва: {0}
37 |
38 | item.level: &fТребуется {0} уровень
39 | item.class: &fТолько для &b{0}
40 | item.nodrop: &7Не выпадает при смерти
41 | item.left-click: &aЛКМ - {0}
42 | item.right-click: &aПКМ - {0}
43 | item.hide: &7&oСвойства скрыты
44 | item.unbreakable: &7Не ломается
45 |
46 | stat.message.no_bonus: Нет бонуса
47 | stat.damage: &cУрон: &7{0}
48 | stat.bow_damage: &cУрон (выстрел): &7{0}
49 | stat.hand_damage: &cУрон (рука): &7{0}
50 | stat.armor: &3Броня: &7{0}
51 | stat.crit_chance: &6Шанс крит.: &7{0}
52 | stat.crit_damage: &6Крит. урон: &7{0}
53 | stat.speed: &9Скорость: &7{0}
54 | stat.jump: &9Прыжок: &7{0}
55 |
56 | backpack.desc: &8&oПоместите в слот рюкзака и нажмите &fПКМ
57 | backpack.size: &aРазмер: &7{0}
58 | backpack.limit: &cУ вас не может быть рюкзаков больше чем {0}!
59 |
--------------------------------------------------------------------------------
/src/main/java/ru/endlesscode/rpginventory/item/ClassedItem.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of RPGInventory.
3 | * Copyright (C) 2015-2017 Osip Fatkullin
4 | *
5 | * RPGInventory is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * RPGInventory is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with RPGInventory. If not, see .
17 | */
18 |
19 | package ru.endlesscode.rpginventory.item;
20 |
21 | import org.bukkit.configuration.ConfigurationSection;
22 | import org.jetbrains.annotations.NotNull;
23 | import org.jetbrains.annotations.Nullable;
24 |
25 | import java.util.List;
26 |
27 | /**
28 | * Created by OsipXD on 27.08.2016
29 | * It is part of the RpgInventory.
30 | * All rights reserved 2014 - 2016 © «EndlessCode Group»
31 | */
32 | public class ClassedItem extends TexturedItem {
33 | private final int level;
34 | @Nullable
35 | private final List classes;
36 |
37 | protected ClassedItem(Texture texture, ConfigurationSection config) {
38 | super(texture);
39 |
40 | this.level = config.getInt("level", -1);
41 | this.classes = config.contains("classes") ? config.getStringList("classes") : null;
42 | }
43 |
44 | public int getLevel() {
45 | return this.level;
46 | }
47 |
48 | @Nullable
49 | protected List getClasses() {
50 | return this.classes;
51 | }
52 |
53 | @NotNull
54 | protected String getClassesString() {
55 | if (this.classes == null) {
56 | return "";
57 | }
58 |
59 | StringBuilder classesString = new StringBuilder();
60 | for (String theClass : this.classes) {
61 | if (classesString.length() > 0) {
62 | classesString.append(", ");
63 | }
64 |
65 | classesString.append(theClass);
66 | }
67 |
68 | return classesString.toString();
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/src/main/resources/lang/pt.lang:
--------------------------------------------------------------------------------
1 | #version: 2.0 | Do not remove this line!
2 | title: RPG Inventory
3 |
4 | locked.name: &cEspaço bloqueado
5 | locked.lore: &6&oDeve desbloquear o espaço anterior
6 |
7 | buyable.name: &aEspaço disponivel
8 | buyable.lore: &6&oPara obter este espaco deve:
9 | buyable.money: &6&o• ter {0} moedas
10 | buyable.level: &6&o• ter {0} nivel(s) de experiencia
11 |
12 | error.fall: &cNão pode fazer isso enquanto esta voando!!
13 | error.money: &6Ainda precisa de {0} moedas
14 | error.level: &6Ainda precisa de {0} niveis
15 | error.buyable: &6Precisa de {0} moedas para comprar esse espaço. Faça um click novamente nos proximos 10seg para confirmar.
16 | error.previous: &6Desbloqueie o espaço previo
17 | error.rp.denied: &cDeve habilitar o download do pacote de recursos!
18 | error.item.level: &6Nivel &c{0} &6requerido
19 | error.item.class: &6Classe &c{0} &6requerida
20 | error.mount.owner: &6A moldura pertence a {0}
21 | error.creative: &4RPGInventory can''t be used in CREATIVE game mode. Please switch to SURVIVAL.
22 |
23 | message.buyed: &a&Você já comprou o espaço
24 | message.perms: &cYou don''t have permission to use this command
25 |
26 | pet.name: {0} &f[{1}]
27 | pet.health: &cVida: &7{0}
28 | pet.damage: &cDano: &7{0}
29 | pet.speed: &cVelocidade: &7{0} blocos/segundo
30 | pet.revival.yes: &bTempo de espera: &7{0}s
31 | pet.revival.no: &bNão resucitará
32 | pet.cooldown: &a&o({0}s)
33 | pet.food.value: &aRestaurou: {0} de vida
34 | pet.role.companion: Acompanhante
35 | pet.role.mount: Monte
36 | mypet.egg: MyPet Egg: {0}
37 |
38 | item.level: &fRequer nivel {0}
39 | item.class: &fExclusivo para &b{0}
40 | item.nodrop: &7Não se dropa ena morte.
41 | item.left-click: &aClick esquerdo - {0}
42 | item.right-click: &aClick direito - {0}
43 | item.hide: &7&oEstadísticas do item ocultas
44 | item.unbreakable: &7Item inquebravel
45 |
46 | stat.message.no_bonus: Sem bonus
47 | stat.damage: &cDano: &7{0}
48 | stat.bow_damage: &cDano (flecha): &7{0}
49 | stat.hand_damage: &cDano (mão): &7{0}
50 | stat.armor: &3Armadura: &7{0}
51 | stat.crit_chance: &6Chance de golpe crítico: &7{0}
52 | stat.crit_damage: &6Dano de golpe crítico: &7{0}
53 | stat.speed: &9Velocidade: &7{0}
54 | stat.jump: &9Pulo: &7{0}
55 |
56 | backpack.desc: &8&oColoque-o no espaço fornecido e clique &fClique com o botão direito
57 | backpack.size: &aTamanho: &7{0}
58 | backpack.limit: &cYou can''t have more than {0} backpack!
59 |
--------------------------------------------------------------------------------
/src/main/resources/lang/es.lang:
--------------------------------------------------------------------------------
1 | #version: 2.0 | Do not remove this line!
2 | title: RPG Inventory
3 |
4 | locked.name: &cEspacio bloqueado
5 | locked.lore: &6&oDebes desbloquear el espacio anterior
6 |
7 | buyable.name: &aEspacio disponible
8 | buyable.lore: &6&oPara obtener este espacio debes:
9 | buyable.money: &6&o• tener {0} monedas
10 | buyable.level: &6&o• tener {0} niveles de experiencia
11 |
12 | error.fall: &cNo puedes hacer esto mientras vuelas
13 | error.money: &6Aún necesitas {0} monedas
14 | error.level: &6Aún necesitas {0} niveles de experiencia
15 | error.buyable: &6Necesitas {0} monedas para comprar este espacio. Haz click nuevamente en los próximos 10 segundos para confirmar.
16 | error.previous: &6Desbloquea el espacio previo
17 | error.rp.denied: &cDebes habilitar la descarga del pack de recursos!
18 | error.item.level: &6Nivel &c{0} &6requerido
19 | error.item.class: &6Clase &c{0} &6requerida
20 | error.mount.owner: &6La montura pertenece a {0}
21 | error.creative: &4RPGInventory can''t be used in CREATIVE game mode. Please switch to SURVIVAL.
22 |
23 | message.buyed: &aYa haz comprado el espacio
24 | message.perms: &cYou don''t have permission to use this command
25 |
26 | pet.name: {0} &f[{1}]
27 | pet.health: &cVida: &7{0}
28 | pet.damage: &cDaño: &7{0}
29 | pet.speed: &cVelocidad: &7{0} bloques/segundo
30 | pet.revival.yes: &bTiempo de espera: &7{0}s
31 | pet.revival.no: &bNo resucitará
32 | pet.cooldown: &a&o({0}s)
33 | pet.food.value: &aRestaura: {0} de vida
34 | pet.role.companion: Acompañante
35 | pet.role.mount: Montura
36 | mypet.egg: MyPet Egg: {0}
37 |
38 | item.level: &fRequiere nivel {0}
39 | item.class: &fExclusivo para &b{0}
40 | item.nodrop: &7No se dropea en la muete
41 | item.left-click: &aClick Izquierdo - {0}
42 | item.right-click: &aClick Derecho - {0}
43 | item.hide: &7&oEstadísticas del item ocultas
44 | item.unbreakable: &7Item irrompible
45 |
46 | stat.message.no_bonus: Sin bonus
47 | stat.damage: &cDaño: &7{0}
48 | stat.bow_damage: &cDaño (flecha): &7{0}
49 | stat.hand_damage: &cDaño (mano): &7{0}
50 | stat.armor: &3Armadura: &7{0}
51 | stat.crit_chance: &6Chance de golpe crítico: &7{0}
52 | stat.crit_damage: &6Daño de golpe crítico: &7{0}
53 | stat.speed: &9Velocidad: &7{0}
54 | stat.jump: &9Salto: &7{0}
55 |
56 | backpack.desc: &8&oColócala en el espacio indicado y haz &fClick Derecho
57 | backpack.size: &aTamaño: &7{0}
58 | backpack.limit: &cYou can''t have more than {0} backpack!
59 |
--------------------------------------------------------------------------------
/src/main/resources/lang/de.lang:
--------------------------------------------------------------------------------
1 | #version: 2.0 | Do not remove this line!
2 | title: RPG Inventory
3 |
4 | locked.name: &cGesperrter Slot
5 | locked.lore: &6&oSchalte zuerst vorherige Slots frei
6 |
7 | buyable.name: &aSlot freischaltbar
8 | buyable.lore: &6&oVorraussetzungen für diesen Slot:
9 | buyable.money: &6&o• {0} Gold
10 | buyable.level: &6&o• Level {0}
11 |
12 | error.fall: &cDu kannst das nicht tun während du fliegst.
13 | error.money: &6Um weitere Slots freizuschalten benötigst du noch {0} Gold
14 | error.level: &6Um weitere Slots freizuschalten must du Level {0} erreicht haben.
15 | error.buyable: &6Um diesen Slot freizuschalten benötigst du {0} Gold. Klicke zum Bestätigen innerhalb von 10 Sekunden erneut.
16 | error.previous: &6Du musst zuerst die vorherigen Slots freischalten.
17 | error.rp.denied: &cDu musst dem Download des Resource-Packs zustimmen!
18 | error.item.level: &6Benötigtes &c{0} &6Level
19 | error.item.class: &6Benötigte Klasse &c{0}
20 | error.mount.owner: &6Dieses Reittier gehört: {0}
21 | error.creative: &4RPGInventory can''t be used in CREATIVE game mode. Please switch to SURVIVAL.
22 |
23 | message.buyed: &aDu hast den Slot erfolgreich freigeschaltet
24 | message.perms: &cYou don''t have permission to use this command
25 |
26 | pet.name: {0} &f[{1}]
27 | pet.health: &cLeben: &7{0}
28 | pet.damage: &cSChaden: &7{0}
29 | pet.speed: &cGeschwindigkeit: &7{0} block/s
30 | pet.revival.yes: &bAbklingzeit: &7{0}s
31 | pet.revival.no: &bWird nicht wiederbelebt
32 | pet.cooldown: &a&o({0}s)
33 | pet.food.value: &aStellt {0} LP wieder her
34 | pet.role.companion: Begleiter
35 | pet.role.mount: Reittier
36 | mypet.egg: MyPet Egg: {0}
37 |
38 | item.level: &fBenötigt {0} Level
39 | item.class: &fNur für &b{0}
40 | item.nodrop: &7Dropt nicht beim Tod
41 | item.left-click: &aLMB - {0}
42 | item.right-click: &aRMB - {0}
43 | item.hide: &7&oGegenstandstwerte nicht sichtbar
44 | item.unbreakable: &7Unzerstörbarer Gegenstand
45 |
46 | stat.message.no_bonus: Kein Bonus
47 | stat.damage: &cSchaden: &7{0}
48 | stat.bow_damage: &cSchaden (Bogen): &7{0}
49 | stat.hand_damage: &cSchaden (Hand): &7{0}
50 | stat.armor: &3Rüstung: &7{0}
51 | stat.crit_chance: &6Krit. Chance: &7{0}
52 | stat.crit_damage: &6Krit. Damage: &7{0}
53 | stat.speed: &9Geschwindigkeit: &7{0}
54 | stat.jump: &9Sprung: &7{0}
55 |
56 | backpack.desc: &8&oPlatzieren in den dafür vorgesehenen Slot und drücke &fRMB
57 | backpack.size: &aGröße: &7{0}
58 | backpack.limit: &cYou can''t have more than {0} backpack!
59 |
--------------------------------------------------------------------------------
/src/main/java/ru/endlesscode/rpginventory/event/PlayerInventoryLoadEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of RPGInventory.
3 | * Copyright (C) 2015-2017 Osip Fatkullin
4 | *
5 | * RPGInventory is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * RPGInventory is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with RPGInventory. If not, see .
17 | */
18 |
19 | package ru.endlesscode.rpginventory.event;
20 |
21 | import org.bukkit.entity.Player;
22 | import org.bukkit.event.Cancellable;
23 | import org.bukkit.event.HandlerList;
24 | import org.bukkit.event.player.PlayerEvent;
25 | import org.jetbrains.annotations.NotNull;
26 |
27 | /**
28 | * Created by OsipXD on 11.09.2015
29 | * It is part of the RpgInventory.
30 | * All rights reserved 2014 - 2016 © «EndlessCode Group»
31 | */
32 | public class PlayerInventoryLoadEvent extends PlayerEvent {
33 | private static final HandlerList handlers = new HandlerList();
34 |
35 | private PlayerInventoryLoadEvent(Player who) {
36 | super(who);
37 | }
38 |
39 | @NotNull
40 | @SuppressWarnings("unused")
41 | public static HandlerList getHandlerList() {
42 | return handlers;
43 | }
44 |
45 | @NotNull
46 | @Override
47 | public HandlerList getHandlers() {
48 | return handlers;
49 | }
50 |
51 | public static class Pre extends PlayerInventoryLoadEvent implements Cancellable {
52 | private boolean cancelled = false;
53 |
54 | public Pre(Player who) {
55 | super(who);
56 | }
57 |
58 | @Override
59 | public boolean isCancelled() {
60 | return this.cancelled;
61 | }
62 |
63 | @Override
64 | public void setCancelled(boolean cancelled) {
65 | this.cancelled = cancelled;
66 | }
67 | }
68 |
69 | public static class Post extends PlayerInventoryLoadEvent {
70 | public Post(Player who) {
71 | super(who);
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/src/main/java/ru/endlesscode/rpginventory/RPGInventoryPlugin.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of RPGInventory.
3 | * Copyright (C) 2018 EndlessCode Group and contributors
4 | *
5 | * RPGInventory is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * RPGInventory is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with RPGInventory. If not, see .
17 | */
18 |
19 | package ru.endlesscode.rpginventory;
20 |
21 | import ru.endlesscode.inspector.bukkit.plugin.TrackedPlugin;
22 | import ru.endlesscode.inspector.bukkit.report.BukkitEnvironment;
23 | import ru.endlesscode.inspector.report.*;
24 | import ru.endlesscode.inspector.sentry.bukkit.SentryBukkitIntegration;
25 | import ru.endlesscode.rpginventory.utils.Log;
26 |
27 | import java.util.Arrays;
28 | import java.util.List;
29 |
30 | @SuppressWarnings("unused")
31 | public class RPGInventoryPlugin extends TrackedPlugin {
32 |
33 | private static final List INTEREST_PLUGINS = Arrays.asList(
34 | "ProtocolLib", "Vault", "Mimic", "BattleLevels", "Skills", "Heroes", "RacesAndClasses",
35 | "SkillAPI", "MyPet", "RPGPlayerLeveling", "PlaceholderAPI", "MMOItems", "QuantumRPG",
36 | "MMOCore", "MMOInventory"
37 | );
38 |
39 | public RPGInventoryPlugin() {
40 | super(RPGInventory.class, new BukkitEnvironment.Properties(INTEREST_PLUGINS));
41 | }
42 |
43 | @Override
44 | protected final Reporter createReporter() {
45 | String dsn = "@sentry_dsn@";
46 | // Token will be replaced in compile time, so it can be empty
47 | // noinspection ConstantConditions
48 | if (dsn.isEmpty()) {
49 | Log.w("It is unofficial build of RPGInventory.");
50 | return null;
51 | }
52 |
53 | return new SentryReporter.Builder()
54 | .setDsn(dsn)
55 | .addIntegration(new SentryBukkitIntegration(this))
56 | .focusOn(this)
57 | .build();
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/main/java/ru/endlesscode/rpginventory/inventory/slot/ActionSlot.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of RPGInventory.
3 | * Copyright (C) 2015-2017 Osip Fatkullin
4 | *
5 | * RPGInventory is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * RPGInventory is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with RPGInventory. If not, see .
17 | */
18 |
19 | package ru.endlesscode.rpginventory.inventory.slot;
20 |
21 | import org.bukkit.configuration.ConfigurationSection;
22 | import org.bukkit.entity.Player;
23 | import org.jetbrains.annotations.NotNull;
24 | import ru.endlesscode.rpginventory.inventory.InventoryManager;
25 | import ru.endlesscode.rpginventory.utils.SafeEnums;
26 |
27 | /**
28 | * Created by OsipXD on 06.09.2015
29 | * It is part of the RpgInventory.
30 | * All rights reserved 2014 - 2016 © «EndlessCode Group»
31 | */
32 | public class ActionSlot extends Slot {
33 | private final ActionType actionType;
34 | private final String command;
35 | private final boolean isGui;
36 |
37 | ActionSlot(String name, @NotNull ConfigurationSection config) {
38 | super(name, SlotType.ACTION, config);
39 |
40 | this.actionType = SafeEnums.valueOf(ActionType.class, config.getString("action"), "action type");
41 | this.command = config.getString("command");
42 | this.isGui = config.getBoolean("gui", false);
43 | }
44 |
45 | public void preformAction(@NotNull Player player) {
46 | if (this.isGui) {
47 | player.closeInventory();
48 | }
49 |
50 | if (this.actionType == ActionType.WORKBENCH) {
51 | InventoryManager.get(player).openWorkbench();
52 | } else if (this.actionType == ActionType.ENDERCHEST) {
53 | player.openInventory(player.getEnderChest());
54 | } else if (this.actionType == ActionType.COMMAND && command != null) {
55 | player.performCommand(command);
56 | }
57 | }
58 |
59 | private enum ActionType {
60 | WORKBENCH,
61 | ENDERCHEST,
62 | COMMAND
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/src/main/java/ru/endlesscode/rpginventory/api/PetAPI.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of RPGInventory.
3 | * Copyright (C) 2015-2017 Osip Fatkullin
4 | *
5 | * RPGInventory is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * RPGInventory is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with RPGInventory. If not, see .
17 | */
18 |
19 | package ru.endlesscode.rpginventory.api;
20 |
21 | import org.bukkit.entity.Player;
22 | import org.bukkit.inventory.ItemStack;
23 | import org.jetbrains.annotations.Nullable;
24 | import ru.endlesscode.rpginventory.inventory.InventoryManager;
25 | import ru.endlesscode.rpginventory.inventory.PlayerWrapper;
26 | import ru.endlesscode.rpginventory.pet.PetManager;
27 | import ru.endlesscode.rpginventory.pet.PetType;
28 | import ru.endlesscode.rpginventory.utils.ItemUtils;
29 |
30 | /**
31 | * Created by OsipXD on 03.09.2015
32 | * It is part of the RpgInventory.
33 | * All rights reserved 2014 - 2016 © «EndlessCode Group»
34 | */
35 | @SuppressWarnings({"unused", "WeakerAccess"})
36 | public class PetAPI {
37 | /**
38 | * Get pet spawn item from RPGInventory of specific player.
39 | *
40 | * @param player - not null player
41 | * @return ItemStack if player have pet spawn item, null - otherwise
42 | */
43 | @Nullable
44 | public static ItemStack getPetItem(Player player) {
45 | if (!InventoryManager.playerIsLoaded(player) || !PetManager.isEnabled()) {
46 | return null;
47 | }
48 |
49 | PlayerWrapper playerWrapper = InventoryManager.get(player);
50 | ItemStack petItem = playerWrapper.getInventory().getItem(PetManager.getPetSlotId());
51 |
52 | return ItemUtils.isEmpty(petItem) ? null : petItem;
53 | }
54 |
55 | /**
56 | * Get Pet of specific player.
57 | *
58 | * @param player - not null player
59 | * @return Pet if player have pet, null - otherwise
60 | */
61 | @Nullable
62 | public static PetType getPet(Player player) {
63 | return PetManager.getPetFromItem(PetAPI.getPetItem(player));
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/src/main/java/ru/endlesscode/rpginventory/compat/VersionHandler.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of RPGInventory.
3 | * Copyright (C) 2015-2017 Osip Fatkullin
4 | *
5 | * RPGInventory is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * RPGInventory is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with RPGInventory. If not, see .
17 | */
18 |
19 | package ru.endlesscode.rpginventory.compat;
20 |
21 | import org.bukkit.Bukkit;
22 | import ru.endlesscode.rpginventory.utils.Version;
23 |
24 | import java.util.regex.Matcher;
25 | import java.util.regex.Pattern;
26 |
27 | /**
28 | * Created by OsipXD on 29.08.2015
29 | * It is part of the RpgInventory.
30 | * All rights reserved 2014 - 2016 © «EndlessCode Group»
31 | */
32 | public class VersionHandler {
33 |
34 | public static final int VERSION_1_11 = 1_11_00;
35 | public static final int VERSION_1_12 = 1_12_00;
36 | public static final int VERSION_1_13 = 1_13_00;
37 | public static final int VERSION_1_14 = 1_14_00;
38 | public static final int VERSION_1_15 = 1_15_00;
39 | public static final int VERSION_1_16 = 1_16_00;
40 | public static final int VERSION_1_17 = 1_17_00;
41 | public static final int VERSION_1_18 = 1_18_00;
42 | public static final int VERSION_1_19 = 1_19_00;
43 |
44 | private static final Pattern pattern = Pattern.compile("(?\\d\\.\\d{1,2}(\\.\\d)?)-.*");
45 |
46 | private static int versionCode = -1;
47 |
48 | public static boolean isNotSupportedVersion() {
49 | return getVersionCode() < VERSION_1_14 || getVersionCode() >= VERSION_1_19;
50 | }
51 |
52 | public static boolean isExperimentalSupport() {
53 | return getVersionCode() == VERSION_1_18;
54 | }
55 |
56 | public static boolean isLegacy() {
57 | return getVersionCode() < VERSION_1_13;
58 | }
59 |
60 | public static int getVersionCode() {
61 | if (versionCode == -1) {
62 | initVersionCode();
63 | }
64 |
65 | return versionCode;
66 | }
67 |
68 | private static void initVersionCode() {
69 | Matcher matcher = pattern.matcher(Bukkit.getBukkitVersion());
70 | if (matcher.find()) {
71 | String versionString = matcher.group("version");
72 | versionCode = Version.parseVersion(versionString).getVersionCode();
73 | } else {
74 | versionCode = 0;
75 | }
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/src/main/resources/pets.yml.legacy:
--------------------------------------------------------------------------------
1 | pets:
2 | kitty:
3 | name: "&7&lKitty"
4 | item-name: "&7&lKitty's Summoning Stone"
5 | lore:
6 | - "&e&oMeow! Meow! Meow!"
7 | item: MONSTER_EGG:Ghast
8 | type: COMPANION
9 | health: 20
10 | damage: 3
11 | speed: 3.5
12 | attack-mobs: false
13 | attack-players: false
14 | revival: true
15 | cooldown: 60
16 | skin: OCELOT
17 | features:
18 | - "BABY: TRUE"
19 | - "TYPE: BLACK_CAT"
20 | puppy:
21 | name: "&7&lPuppy"
22 | item-name: "&7&lPuppy's Summoning Stone"
23 | lore:
24 | - "&e&oWoof! Woof! Woof!"
25 | item: MONSTER_EGG:Ghast
26 | type: COMPANION
27 | health: 20
28 | damage: 3
29 | speed: 3.5
30 | attack-mobs: true
31 | attack-players: false
32 | revival: true
33 | cooldown: 60
34 | features:
35 | - "BABY: TRUE"
36 | - "COLLAR: BLACK"
37 | rare-wolf:
38 | name: "&9&lWolf"
39 | item-name: "&9&lWolf's Summoning Stone"
40 | lore:
41 | - "&e&oBest friend - a proven friend"
42 | item: MONSTER_EGG:Skeleton
43 | type: COMPANION
44 | health: 30
45 | damage: 5
46 | speed: 4
47 | attack-mobs: false
48 | attack-players: true
49 | revival: true
50 | cooldown: 45
51 | features:
52 | - "COLLAR: BLUE"
53 | legendary-wolf:
54 | name: "&5&lGrand Wolf"
55 | item-name: "&5&lGrand Wolf's Summoning Stone"
56 | lore:
57 | - "&e&o...but only a few become legends..."
58 | item: MONSTER_EGG:Silverfish
59 | type: COMPANION
60 | level: 10
61 | classes:
62 | - Mage
63 | - Warrior
64 | health: 50
65 | damage: 10
66 | speed: 6
67 | mount: true
68 | attack-mobs: true
69 | attack-players: true
70 | revival: true
71 | cooldown: 30
72 | features:
73 | - "COLLAR: PURPLE"
74 | horse:
75 | name: "&6&lHorse"
76 | item-name: "&5&lHorse's Summoning Stone"
77 | lore:
78 | - "&e&oRide like the wind!"
79 | item: MONSTER_EGG:Zombie
80 | type: MOUNT
81 | health: 100
82 | speed: 10
83 | revival: true
84 | cooldown: 30
85 | features:
86 | - "CHEST: FALSE"
87 | - "ARMOR: IRON_BARDING"
88 | - "COLOR: DARK_BROWN"
89 | - "STYLE: WHITE"
90 | pig:
91 | name: "&6&lPig"
92 | item-name: "&5&lPig's Summoning Stone"
93 | lore:
94 | - "&e&oRide faster than wind!"
95 | - "&e&oBut... where my carrot?"
96 | item: MONSTER_EGG:Pig
97 | type: MOUNT
98 | health: 100
99 | speed: 12.5
100 | revival: true
101 | cooldown: 60
102 | skin: PIG
103 | food:
104 | bone:
105 | name: "&f&lBone"
106 | lore:
107 | - "&e&o- Rex, come here!"
108 | - "&e&o- Woof! Woof! Woof!"
109 | item: BONE
110 | eaters:
111 | - WOLF
112 | value: 5
113 |
--------------------------------------------------------------------------------
/src/main/resources/pets.yml:
--------------------------------------------------------------------------------
1 | pets:
2 | kitty:
3 | name: "&7&lKitty"
4 | item-name: "&7&lKitty's Summoning Stone"
5 | lore:
6 | - "&e&oMeow! Meow! Meow!"
7 | item: GHAST_SPAWN_EGG
8 | type: COMPANION
9 | health: 20
10 | damage: 3
11 | speed: 3.5
12 | attack-mobs: false
13 | attack-players: false
14 | revival: true
15 | cooldown: 60
16 | skin: CAT
17 | features:
18 | - "BABY: TRUE"
19 | - "TYPE: ALL_BLACK"
20 | - "COLLAR: BLUE"
21 | puppy:
22 | name: "&7&lPuppy"
23 | item-name: "&7&lPuppy's Summoning Stone"
24 | lore:
25 | - "&e&oWoof! Woof! Woof!"
26 | item: GHAST_SPAWN_EGG
27 | type: COMPANION
28 | health: 20
29 | damage: 3
30 | speed: 3.5
31 | attack-mobs: true
32 | attack-players: false
33 | revival: true
34 | cooldown: 60
35 | features:
36 | - "BABY: TRUE"
37 | - "COLLAR: BLACK"
38 | rare-wolf:
39 | name: "&9&lWolf"
40 | item-name: "&9&lWolf's Summoning Stone"
41 | lore:
42 | - "&e&oBest friend - a proven friend"
43 | item: SKELETON_SPAWN_EGG
44 | type: COMPANION
45 | health: 30
46 | damage: 5
47 | speed: 4
48 | attack-mobs: false
49 | attack-players: true
50 | revival: true
51 | cooldown: 45
52 | features:
53 | - "COLLAR: BLUE"
54 | legendary-wolf:
55 | name: "&5&lGrand Wolf"
56 | item-name: "&5&lGrand Wolf's Summoning Stone"
57 | lore:
58 | - "&e&o...but only a few become legends..."
59 | item: SILVERFISH_SPAWN_EGG
60 | type: COMPANION
61 | level: 10
62 | classes:
63 | - Mage
64 | - Warrior
65 | health: 50
66 | damage: 10
67 | speed: 6
68 | mount: true
69 | attack-mobs: true
70 | attack-players: true
71 | revival: true
72 | cooldown: 30
73 | features:
74 | - "COLLAR: PURPLE"
75 | horse:
76 | name: "&6&lHorse"
77 | item-name: "&5&lHorse's Summoning Stone"
78 | lore:
79 | - "&e&oRide like the wind!"
80 | item: ZOMBIE_SPAWN_EGG
81 | type: MOUNT
82 | health: 100
83 | speed: 10
84 | revival: true
85 | cooldown: 30
86 | features:
87 | - "CHEST: FALSE"
88 | - "ARMOR: IRON_BARDING"
89 | - "COLOR: DARK_BROWN"
90 | - "STYLE: WHITE"
91 | pig:
92 | name: "&6&lPig"
93 | item-name: "&5&lPig's Summoning Stone"
94 | lore:
95 | - "&e&oRide faster than wind!"
96 | - "&e&oBut... where my carrot?"
97 | item: PIG_SPAWN_EGG
98 | type: MOUNT
99 | health: 100
100 | speed: 12.5
101 | revival: true
102 | cooldown: 60
103 | skin: PIG
104 | food:
105 | bone:
106 | name: "&f&lBone"
107 | lore:
108 | - "&e&o- Rex, come here!"
109 | - "&e&o- Woof! Woof! Woof!"
110 | item: BONE
111 | eaters:
112 | - WOLF
113 | value: 5
114 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
90 |
--------------------------------------------------------------------------------
/src/main/java/ru/endlesscode/rpginventory/utils/NbtFactoryMirror.java:
--------------------------------------------------------------------------------
1 | package ru.endlesscode.rpginventory.utils;
2 |
3 | import com.comphenix.protocol.reflect.StructureModifier;
4 | import com.comphenix.protocol.utility.MinecraftReflection;
5 | import com.comphenix.protocol.wrappers.BukkitConverters;
6 | import com.comphenix.protocol.wrappers.nbt.NbtBase;
7 | import com.comphenix.protocol.wrappers.nbt.NbtCompound;
8 | import com.comphenix.protocol.wrappers.nbt.NbtFactory;
9 | import com.comphenix.protocol.wrappers.nbt.NbtWrapper;
10 | import org.bukkit.Material;
11 | import org.bukkit.inventory.ItemStack;
12 |
13 | /**
14 | * For some kind of shit, ProtocolLib's method works wrong in version 4.4.0 But if I just copy
15 | * their code to my class it works fine. Recompiling of ProtocolLib also helps. (╯°□°)╯︵ ┻━┻
16 | * TODO: Remove when new version of ProtocolLib will be released.
17 | * Track progress of the issue here: https://github.com/dmulloy2/ProtocolLib/issues/587
18 | */
19 | public final class NbtFactoryMirror {
20 |
21 | private static StructureModifier