Skip to content

Commit

Permalink
Finalize initial plugin logic, readme and license files
Browse files Browse the repository at this point in the history
  • Loading branch information
knownout committed Aug 1, 2023
1 parent 9105120 commit 935496a
Show file tree
Hide file tree
Showing 15 changed files with 938 additions and 174 deletions.
2 changes: 1 addition & 1 deletion .idea/artifacts/BetterExperience_jar.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 25 additions & 21 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Alexandr Slavinskii

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
75 changes: 75 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Better Experience

Transform your experience in something really usable.

```text
Tested minecraft versions: 1.20.1
Native version: 1.20.1
API level: 1.20
```

This plugin allows you to configure generic attributes of player based on it's level,
create experience bottles for self experience and use some abilities after reaching high levels

## Experience bottles expansion

Players now can create experience bottles from themselves experience points using specified in config blocks.
By default, players can use enchanting table and anvil.

To create experience bottle, with default configuration, just sneak and right click on one of specified blocks.

### Locking and unlocking

Players can protect their experience bottles from being used by other players.

To lock bottle, take it in main hand and then just right click on one of specified blocks, unlocking works same.

Lock, unlock and use locked bottles can only bottle owner and players with `betterexperience.bottles.useLocked`
permission.


## Evolve
Evolve system allow players to increase their health, strength and receive some other benefits from their level.

### Generic attributes list

Attributes that plugin uses by default:

| Attribute | Description | Default | Min | Max |
|-------------------------|--------------------------------------------------------------------------------------------------------|---------|-----|--------|
| `GENERIC_MAX_HEALTH` | Maximum health of player | 20.0 | 0.0 | 1024.0 |
| `GENERIC_ATTACK_DAMAGE` | Damage dealt by attacks, in half-hearts | 2.0 | 0.0 | 2048.0 |
| `GENERIC_ATTACK_SPEED` | Determines recharging rate of attack strength.Value is the number of full-strength attacks per second. | 4.0 | 0.0 | 1024.0 |

All attributes list: https://minecraft.fandom.com/wiki/Attribute

### Damage protection

Damage protection will subtract specified percent of damage from final damage (after subtracting damage
absorbed by armor and effects) before player receive it.

Values is set on percents divided by 100 — from 0 to 1

### Abilities

Abilities are mechanics that allow the players to apply certain effects to themselves using specified in config items.
Each ability has a usage price in experience points that will be subtracted from player after each usage.

`enablePriceImpact` option enables price increases when player applies too long effects and
will increase price from 0 to 100% per usage.

## To-do list
- [ ] Create GUI to view own evolve stats
- [ ] Fix permissions system

## Permissions

All permissions disabled by default, you can enable it in plugin config

| Permission | Description | Default |
|-----------------------------------------------|-----------------------------------------------|--------------|
| `betterexperience.bottles.create` | Allow player to create experience bottles | no op |
| `betterexperience.bottles.lockUnlock` | Allow player to lock experience bottles | no op |
| `betterexperience.bottles.useWithoutBreaking` | Allow player to use bottles without breaking | no op |
| `betterexperience.bottles.useLocked` | Allow player to use locked experience bottles | op, disabled |
| `betterexperience.evolve` | Allow player to evolve | no op |
26 changes: 13 additions & 13 deletions src/main/java/net/kwnt/mc/plugins/betterexperience/Main.java
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
package net.kwnt.mc.plugins.betterexperience;

import net.kwnt.mc.plugins.betterexperience.evolve.setup.PlayerAttributesSetup;
import net.kwnt.mc.plugins.betterexperience.bottles.BottleInteractions;
import net.kwnt.mc.plugins.betterexperience.evolve.PlayerAttributes;
import net.kwnt.mc.plugins.betterexperience.evolve.PlayerAbilityEffects;
import net.kwnt.mc.plugins.betterexperience.evolve.PlayerDamageProtection;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin;

public class Main extends JavaPlugin implements Listener {
public class Main extends JavaPlugin {
@Override
public void onEnable() {
saveDefaultConfig();

Bukkit.getPluginManager().registerEvents(this, this);
}

@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
FileConfiguration configuration = getConfig();

new PlayerAttributesSetup(player, configuration);
// Register evolve mechanics controllers
Bukkit.getPluginManager().registerEvents(new PlayerAttributes(configuration), this);
Bukkit.getPluginManager().registerEvents(new PlayerDamageProtection(configuration), this);
Bukkit.getPluginManager().registerEvents(new PlayerAbilityEffects(configuration), this);

// Register experience bottles mechanics controller
Bukkit.getPluginManager().registerEvents(new BottleInteractions(configuration, this), this);
}

}
Loading

0 comments on commit 935496a

Please sign in to comment.