91 Commits

Author SHA1 Message Date
14fd38ccaf Merge pull request 'bugfix/remove_anvill_costcap' (#83) from bugfix/remove_anvill_costcap into Testing
All checks were successful
Build and Release Minecraft Plugin / build-and-release (push) Successful in 1m48s
Reviewed-on: #83
2025-12-07 16:36:42 +01:00
116dcc1a0e bugfix 🪱 fixed that cost override would not affect anvill 2025-12-07 16:35:54 +01:00
1ff91018a6 bugfix 🪱 fixed possible bug that features may be activated even when config says they should not; improved loggin; properly added anvill event listener; replaced deprecated AnvillInventory with new AnvilView 2025-12-07 16:06:38 +01:00
16800135f0 Merge pull request 'src/main/java/de/steev/bm/Listener/PrepareAnvilListener.java aktualisiert' (#82) from bugfix/remove_anvill_costcap into Testing
Some checks failed
Build and Release Minecraft Plugin / build-and-release (push) Failing after 1m59s
Reviewed-on: #82
2025-12-03 14:30:27 +01:00
5eb08e1859 src/main/java/de/steev/bm/Listener/PrepareAnvilListener.java aktualisiert 2025-12-03 14:30:11 +01:00
ad3b275214 Merge pull request 'added eventlistener to plugin instance' (#81) from bugfix/remove_anvill_costcap into Testing
Some checks failed
Build and Release Minecraft Plugin / build-and-release (push) Failing after 2m0s
Reviewed-on: #81
2025-12-03 14:21:28 +01:00
6c2a56a179 added eventlistener to plugin instance 2025-12-03 14:20:41 +01:00
1a00dacdc2 Merge pull request 'bugfix/remove_anvill_costcap' (#76) from bugfix/remove_anvill_costcap into Testing
All checks were successful
Build and Release Minecraft Plugin / build-and-release (push) Successful in 2m28s
Reviewed-on: #76
2025-12-02 21:26:49 +01:00
725a964c79 bugfix 🪱 fixed missing symbol error 2025-12-02 21:23:27 +01:00
bb5d6c0b7f bugfix 🪱 readded lost getter function for playerDataConfig 2025-12-02 21:16:05 +01:00
868286d462 Merge pull request 'bugfix/remove_anvill_costcap' (#73) from bugfix/remove_anvill_costcap into Testing
Some checks failed
Build and Release Minecraft Plugin / build-and-release (push) Failing after 50s
Reviewed-on: #73
2025-12-02 21:11:00 +01:00
117d53024b Merge branch 'Testing' into bugfix/remove_anvill_costcap 2025-12-02 21:10:38 +01:00
adff0d6c72 resolved merge conflict
Some checks failed
Build and Release Minecraft Plugin / build-and-release (push) Has been cancelled
2025-12-02 21:09:32 +01:00
e29591bb7b removed cost cap from anvill 2025-12-02 21:08:03 +01:00
18de7529a6 resovled merge conflict
Some checks failed
Build and Release Minecraft Plugin / build-and-release (push) Failing after 3m43s
2025-12-02 20:46:47 +01:00
95dd560779 halted Changelog Screen refactor 2025-12-02 20:39:39 +01:00
2879109f59 .gitea/workflows/test.yml aktualisiert 2024-12-27 04:26:14 +01:00
50477bbace .gitea/workflows/release.yml aktualisiert 2024-12-27 04:25:10 +01:00
27b00aa28c Merge pull request 'main' (#67) from main into Testing
All checks were successful
Build and Release Minecraft Plugin / build-and-release (push) Successful in 1m1s
Reviewed-on: Steev/betterminecraft#67
2024-12-27 04:24:13 +01:00
12813cdc13 .gitea/workflows/test-release.yml aktualisiert 2024-12-27 04:24:00 +01:00
149c81dce0 .gitea/workflows/release.yml aktualisiert 2024-12-27 04:23:28 +01:00
78852274ad Merge pull request '.gitea/workflows/test-release.yml aktualisiert' (#66) from main into Testing
Reviewed-on: Steev/betterminecraft#66
test commit
2024-12-27 04:20:51 +01:00
ca3a3de361 .gitea/workflows/test-release.yml aktualisiert
Some checks failed
Build and Release Minecraft Plugin / build-and-release (pull_request) Failing after 58s
2024-12-27 04:20:28 +01:00
96a826561f Merge pull request '.gitea/workflows/test-release.yml aktualisiert' (#65) from main into Testing
Reviewed-on: Steev/betterminecraft#65
2024-12-27 04:14:17 +01:00
881a303196 .gitea/workflows/test-release.yml aktualisiert
All checks were successful
Build and Release Minecraft Plugin / build-and-release (pull_request) Successful in 2m30s
2024-12-27 04:14:05 +01:00
f839ab9690 Merge pull request '.gitea/workflows/test-release.yml aktualisiert' (#64) from main into Testing
Reviewed-on: Steev/betterminecraft#64
2024-12-27 04:12:00 +01:00
68191b79c5 .gitea/workflows/test-release.yml aktualisiert
Some checks failed
Build and Release Minecraft Plugin / build-and-release (pull_request) Failing after 57s
2024-12-27 04:11:47 +01:00
f855c43364 Merge pull request '.gitea/workflows/test-release.yml aktualisiert' (#63) from main into Testing
Reviewed-on: Steev/betterminecraft#63
2024-12-27 04:09:02 +01:00
9e6d61f20d .gitea/workflows/test-release.yml aktualisiert
Some checks failed
Build and Release Minecraft Plugin / build-and-release (pull_request) Failing after 54s
2024-12-27 04:08:47 +01:00
98bfffd7aa Merge pull request '.gitea/workflows/test-release.yml aktualisiert' (#62) from main into Testing
Reviewed-on: Steev/betterminecraft#62
2024-12-27 04:05:47 +01:00
7807364a98 .gitea/workflows/test-release.yml aktualisiert
Some checks failed
Build and Release Minecraft Plugin / build-and-release (pull_request) Failing after 2m16s
2024-12-27 04:05:33 +01:00
85fca1fd6f Merge pull request '.gitea/workflows/test-release.yml aktualisiert' (#61) from main into Testing
Reviewed-on: Steev/betterminecraft#61
2024-12-27 04:05:07 +01:00
ee4567c5d0 .gitea/workflows/test-release.yml aktualisiert 2024-12-27 04:04:55 +01:00
4ab622e7b7 Merge pull request '.gitea/workflows/test-release.yml aktualisiert' (#60) from main into Testing
Reviewed-on: Steev/betterminecraft#60
2024-12-27 04:03:16 +01:00
51ad4f64a5 .gitea/workflows/test-release.yml aktualisiert
Some checks failed
Build and Release Minecraft Plugin / build-and-release (pull_request) Failing after 53s
2024-12-27 04:03:05 +01:00
2713333df2 Merge pull request 'main' (#59) from main into Testing
Reviewed-on: Steev/betterminecraft#59
2024-12-27 04:02:44 +01:00
ffcdcabf8a .gitea/workflows/test-release.yml aktualisiert
Some checks failed
Build and Release Minecraft Plugin / build-and-release (pull_request) Has been cancelled
2024-12-27 04:02:16 +01:00
a16500904c .gitea/workflows/test-release.yml aktualisiert 2024-12-27 04:01:25 +01:00
8b7c49e766 Merge pull request '.gitea/workflows/test.md aktualisiert' (#58) from main into Testing
All checks were successful
Build and Release Minecraft Plugin / build-and-release (push) Successful in 2m24s
Reviewed-on: Steev/betterminecraft#58
2024-12-27 03:57:18 +01:00
dfccc5567a .gitea/workflows/test.md aktualisiert 2024-12-27 03:56:58 +01:00
d408feaf1a Merge pull request '.gitea/workflows/test-release.yml aktualisiert' (#57) from main into Testing
All checks were successful
Build and Release Minecraft Plugin / build-and-release (push) Successful in 53s
Reviewed-on: Steev/betterminecraft#57
2024-12-27 03:53:53 +01:00
5b622cc85c .gitea/workflows/test-release.yml aktualisiert 2024-12-27 03:53:29 +01:00
b4a41b0277 Merge pull request 'main' (#56) from main into Testing
All checks were successful
Build and Release Minecraft Plugin / build-and-release (push) Successful in 51s
## changes
- updated pipeline for test
2024-12-27 03:50:54 +01:00
839b9f6acb .gitea/workflows/test-release.yml aktualisiert 2024-12-27 03:50:01 +01:00
e54b14c833 .gitea/workflows/test-release.yml aktualisiert 2024-12-27 03:46:07 +01:00
42dd11b7b1 Merge pull request '.gitea/workflows/test-release.yml aktualisiert' (#55) from main into Testing
All checks were successful
Build and Release Minecraft Plugin / build-and-release (push) Successful in 56s
Reviewed-on: Steev/betterminecraft#55
2024-12-27 03:44:02 +01:00
360b4562a5 .gitea/workflows/test-release.yml aktualisiert 2024-12-27 03:43:50 +01:00
750cb6209d Merge pull request '.gitea/workflows/test.md aktualisiert' (#54) from main into Testing
All checks were successful
Build and Release Minecraft Plugin / build-and-release (push) Successful in 56s
Reviewed-on: Steev/betterminecraft#54
2024-12-27 03:40:42 +01:00
b576aa55b7 .gitea/workflows/test.md aktualisiert 2024-12-27 03:40:15 +01:00
d66fcb5185 Merge pull request '.gitea/workflows/test-release.yml aktualisiert' (#53) from main into Testing
All checks were successful
Build and Release Minecraft Plugin / build-and-release (push) Successful in 57s
Reviewed-on: Steev/betterminecraft#53
2024-12-27 03:38:34 +01:00
fd8b3ab94d .gitea/workflows/test-release.yml aktualisiert 2024-12-27 03:38:19 +01:00
88efe99327 Merge pull request '.gitea/workflows/test-release.yml aktualisiert' (#52) from main into Testing
Some checks failed
Build and Release Minecraft Plugin / build-and-release (push) Has been cancelled
Reviewed-on: Steev/betterminecraft#52
2024-12-27 03:37:52 +01:00
113f0ce247 .gitea/workflows/test-release.yml aktualisiert 2024-12-27 03:37:35 +01:00
195e12e7e4 .gitea/workflows/test-release.yml aktualisiert
All checks were successful
Build and Release Minecraft Plugin / build-and-release (push) Successful in 3m36s
2024-12-27 03:29:44 +01:00
fb489ecd1d Merge pull request '.gitea/workflows/test-release.yml aktualisiert' (#51) from main into Testing
Reviewed-on: Steev/betterminecraft#51
2024-12-27 03:29:18 +01:00
00c3c3d653 .gitea/workflows/test-release.yml aktualisiert 2024-12-27 03:28:54 +01:00
516e1da1e8 Merge pull request '.gitea/workflows/test-release.yml aktualisiert' (#50) from main into Testing
Reviewed-on: Steev/betterminecraft#50
2024-12-27 03:27:57 +01:00
79a41180bc .gitea/workflows/test-release.yml aktualisiert 2024-12-27 03:27:42 +01:00
4ec58fcec3 Merge pull request 'testing workflow' (#49) from main into Testing
Reviewed-on: Steev/betterminecraft#49
2024-12-27 03:24:47 +01:00
aa023d46bb .gitea/workflows/test.md aktualisiert 2024-12-27 03:24:36 +01:00
3096c1090e Merge pull request '.gitea/workflows/test.md hinzugefügt' (#48) from main into Testing
Reviewed-on: Steev/betterminecraft#48
2024-12-27 03:17:38 +01:00
2521e32411 .gitea/workflows/test.md hinzugefügt 2024-12-27 03:17:23 +01:00
057b5672e1 Merge pull request 'main' (#47) from main into Testing
Reviewed-on: Steev/betterminecraft#47
2024-12-27 03:15:41 +01:00
d786e9de94 .gitea/workflows/test-release.yml aktualisiert 2024-12-27 03:15:23 +01:00
b5566c4d4e .gitea/workflows/test-release.yml aktualisiert 2024-12-27 03:14:31 +01:00
807150d83e .gitea/workflows/test-release.yml aktualisiert 2024-12-27 03:13:29 +01:00
451ca47fb3 Merge pull request '.gitea/workflows/test-release.yml aktualisiert' (#46) from main into Testing
Reviewed-on: Steev/betterminecraft#46
2024-12-27 03:12:37 +01:00
3315017b82 .gitea/workflows/test-release.yml aktualisiert 2024-12-27 03:11:51 +01:00
c1b3db80b2 Merge pull request '.gitea/workflows/test-release.yml aktualisiert' (#45) from main into Testing
Reviewed-on: Steev/betterminecraft#45
2024-12-27 03:11:05 +01:00
b0accb96cc .gitea/workflows/test-release.yml aktualisiert 2024-12-27 03:10:51 +01:00
0ea61bfcd7 Merge pull request '.gitea/workflows/release.yml.off gelöscht' (#44) from main into Testing
Reviewed-on: Steev/betterminecraft#44
2024-12-27 03:10:07 +01:00
1e4bbe5d55 .gitea/workflows/test-release.yml aktualisiert 2024-12-27 03:09:50 +01:00
b05e054bd7 Merge branch 'Testing' into main 2024-12-27 03:07:13 +01:00
2ef476372f .gitea/workflows/test-release.yml aktualisiert 2024-12-27 03:07:00 +01:00
385886c7f5 .gitea/workflows/release.yml.off gelöscht 2024-12-27 03:06:21 +01:00
ef5c81d7cc Merge pull request 'testing workflow' (#43) from main into Testing
Reviewed-on: Steev/betterminecraft#43
2024-12-27 03:05:54 +01:00
5628dfb459 Merge pull request 'Testing workflow' (#42) from Testing into main
Reviewed-on: Steev/betterminecraft#42
2024-12-27 03:05:04 +01:00
dbbb60280b .gitea/workflows/test-release.yml hinzugefügt 2024-12-27 03:03:59 +01:00
750042d7a9 .gitea/workflows/release.yml aktualisiert 2024-12-27 03:02:42 +01:00
1bac43b3fe changelog.txt hinzugefügt 2024-12-27 02:42:16 +01:00
59611ac1d1 added changelog handler class 2024-12-05 09:29:55 +01:00
7e759aace3 refactored config to it's own class 2024-11-28 10:27:58 +01:00
02856bc49a Merge pull request 'fixed bug that prevented plants from resetting age' (#32) from config_support into Testing
Reviewed-on: Steev/betterminecraft#32
2023-10-07 03:28:45 +02:00
d9cfdb218e fixed bug that prevented plants from resetting age 2023-10-07 03:26:54 +02:00
300a1bf67c Merge pull request 'config_support' (#31) from config_support into Testing
Reviewed-on: Steev/betterminecraft#31
2023-10-07 03:12:49 +02:00
6ac6455f2d added config support 2023-10-07 03:09:28 +02:00
0fe5ce24a8 README.md aktualisiert 2023-10-04 19:09:02 +02:00
137a39e430 README.md aktualisiert 2023-10-04 19:08:46 +02:00
8c83b7ddb6 README.md aktualisiert 2023-10-04 19:07:10 +02:00
63ffe0fe2b HOTFIX: changed plugin.yml main class 2023-10-04 18:37:07 +02:00
6743f297b2 HOTFIX: changed false material from WOOL -> WHITE_WOOL 2023-10-04 18:33:21 +02:00
24 changed files with 476 additions and 196 deletions

View File

@@ -0,0 +1,60 @@
name: Build and Release Minecraft Plugin
on:
push:
branches:
- Resting
jobs:
build-and-release:
steps:
# Repository auschecken
- name: Checkout Repository
uses: actions/checkout@v3
# Java 17 installieren
- name: Set up Java 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
# Maven installieren
- name: Install Maven
run: |
sudo apt-get update
sudo apt-get install -y maven
# Plugin-Version aus plugin.yml auslesen
- name: Extract Plugin Version
id: extract_version
run: |
VERSION=$(grep '^version:' src/main/resources/plugin.yml | awk '{print $2}')
echo "PLUGIN_VERSION=$VERSION" >> $GITHUB_ENV
# Projekt mit Maven bauen
- name: Build with Maven
run: mvn clean package
# JAR-Datei umbenennen
- name: Rename JAR File
run: |
mv target/*.jar target/BetterMinecraft-${{ env.PLUGIN_VERSION }}-b.jar
# Artefakt hochladen
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: BetterMinecraft-${{ env.PLUGIN_VERSION }}-b.jar
path: target/BetterMinecraft-${{ env.PLUGIN_VERSION }}-b.jar
# Release erstellen
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: target/BetterMinecraft-${{ env.PLUGIN_VERSION }}-b.jar
tag_name: ${{ env.PLUGIN_VERSION }}
release_name: Release ${{ env.PLUGIN_VERSION }}
draft: false
prerelease: false

View File

@@ -1,65 +0,0 @@
name: Build and Release Minecraft Plugin
on:
push:
branches:
- main
jobs:
build:
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up Java 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt' # Verwenden Sie 'adopt' für Java 17
- name: Update Apt
run: apt update -y
- name: Update CA certificates
run: apt-get install --reinstall ca-certificates -y
- name: Install Maven
run: apt install maven -y
- name: Build with Maven
run: mvn clean install
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: BetterMinecraft-stable.jar
path: target/BetterMinecraft-stable.jar
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Get letzte Release-Version
id: get_version
run: echo "::set-output name=version::$(git describe --tags --abbrev=0 || echo '0.0.0')"
- name: Incrementiere Version
id: increment_version
run: |
IFS='.' read -ra VERSION <<< "${{ steps.get_version.outputs.version }}"
MAJOR="${VERSION[0]}"
MINOR="${VERSION[1]}"
PATCH="${VERSION[2]}"
echo "::set-output name=major::$(($MAJOR + 1))"
echo "::set-output name=minor::$(($MINOR + 1))"
echo "::set-output name=patch::$(($PATCH + 1))"
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
files: |
target/BetterMinecraft-stable.jar
tag_name: ${{ steps.increment_version.outputs.major }}.${{ steps.increment_version.outputs.minor }}.${{ steps.increment_version.outputs.patch }}
release_name: Release ${{ steps.increment_version.outputs.major }}.${{ steps.increment_version.outputs.minor }}.${{ steps.increment_version.outputs.patch }}
draft: false
prerelease: false

View File

@@ -1,65 +0,0 @@
name: Build and Release Minecraft Plugin
on:
push:
branches:
- Release
jobs:
build:
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up Java 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt' # Verwenden Sie 'adopt' für Java 17
- name: Update Apt
run: apt update -y
- name: Update CA certificates
run: apt-get install --reinstall ca-certificates -y
- name: Install Maven
run: apt install maven -y
- name: Build with Maven
run: mvn clean install
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: BetterMinecraft-stable.jar
path: target/BetterMinecraft-stable.jar
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Get letzte Release-Version
id: get_version
run: echo "::set-output name=version::$(git describe --tags --abbrev=0 || echo '0.0.0')"
- name: Incrementiere Version
id: increment_version
run: |
IFS='.' read -ra VERSION <<< "${{ steps.get_version.outputs.version }}"
MAJOR="${VERSION[0]}"
MINOR="${VERSION[1]}"
PATCH="${VERSION[2]}"
echo "::set-output name=major::$(($MAJOR + 1))"
echo "::set-output name=minor::$(($MINOR + 1))"
echo "::set-output name=patch::$(($PATCH + 1))"
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
files: |
target/BetterMinecraft-stable.jar
tag_name: ${{ steps.increment_version.outputs.major }}.${{ steps.increment_version.outputs.minor }}.${{ steps.increment_version.outputs.patch }}
release_name: Release ${{ steps.increment_version.outputs.major }}.${{ steps.increment_version.outputs.minor }}.${{ steps.increment_version.outputs.patch }}
draft: false
prerelease: false

1
.gitea/workflows/test.md Normal file
View File

@@ -0,0 +1 @@
testtesttesttrest

60
.gitea/workflows/test.yml Normal file
View File

@@ -0,0 +1,60 @@
name: Build and Release Minecraft Plugin
on:
push:
branches:
- Testing
jobs:
build-and-release:
steps:
# Repository auschecken
- name: Checkout Repository
uses: actions/checkout@v3
# Java 17 installieren
- name: Set up Java 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
# Maven installieren
- name: Install Maven
run: |
sudo apt-get update
sudo apt-get install -y maven
# Plugin-Version aus plugin.yml auslesen
- name: Extract Plugin Version
id: extract_version
run: |
VERSION=$(grep '^version:' src/main/resources/plugin.yml | awk '{print $2}')
echo "PLUGIN_VERSION=$VERSION" >> $GITHUB_ENV
# Projekt mit Maven bauen
- name: Build with Maven
run: mvn clean package
# JAR-Datei umbenennen
- name: Rename JAR File
run: |
mv target/*.jar target/BetterMinecraft-${{ env.PLUGIN_VERSION }}-b.jar
# Artefakt hochladen
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: BetterMinecraft-${{ env.PLUGIN_VERSION }}-b.jar
path: target/BetterMinecraft-${{ env.PLUGIN_VERSION }}-b.jar
# Release erstellen
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: target/BetterMinecraft-${{ env.PLUGIN_VERSION }}-b.jar
tag_name: ${{ env.PLUGIN_VERSION }}
release_name: Release ${{ env.PLUGIN_VERSION }}
draft: false
prerelease: true

View File

@@ -1,3 +1,27 @@
# betterminecraft
sandboxplugin to fix mojang fuckups
you can use my code when you link this repo and name the author
# Contribution
## contribute by code
In order to contribute you need to do the following things
1. Create an issue with the changes you want to add
2. Wait for your feature to be approved
3. Fork the Project and make a branch with the features name
4. make a pull request from your project to the testing branch (pr's to any other branch will be removed)
Now your contribution is in testing where people can start using it as beta on their own servers and report back issues
Once the testing phase is over and now reports come in the feature will be pulled to release from which it then gets its own downloadable release created
## contribute with requests
if you want a certain feature in my plugin write an issue with the enhancement label
you issue should follow this structure
### Feature request
**Name:** how should the feature be named
**Version:** when would you like the feature to be implemented (this might differ from actual implementation)
**Description:** get creative and technical what do you want this feature to do. Your description even might contain pseudo code if you want to provide such
Your feature now can be reviewed by the community and be disscussed uppon and maybe changed to fit the plugin
once it is approved it will be given a releaes milestone and its own feature branch from where it then will continue on the development proccess

2
changelog.txt Normal file
View File

@@ -0,0 +1,2 @@
+ added system type changelog
+ added custom type changelog

View File

@@ -6,7 +6,7 @@
<groupId>de.steev.bm</groupId>
<artifactId>BetterMinecraft</artifactId>
<version>stable</version>
<version>1.2.2</version>
<properties>
<maven.compiler.source>17</maven.compiler.source>
@@ -25,7 +25,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.20.1-R0.1-SNAPSHOT</version>
<version>1.21.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
@@ -37,6 +37,7 @@
<directory>${project.basedir}/src/main/resources</directory>
<includes>
<include>plugin.yml</include>
<include>config.yml</include>
</includes>
</resource>
</resources>

View File

@@ -4,90 +4,85 @@ import de.steev.bm.Commands.back;
import de.steev.bm.Listener.BedListener;
import de.steev.bm.Listener.InteractListener;
import de.steev.bm.Listener.KillListener;
import de.steev.bm.Listener.PrepareAnvilListener;
import de.steev.bm.Manager.GameManager;
import de.steev.bm.utils.Config;
import de.steev.bm.utils.exceptions.ConfigEntryExceptions;
import org.bukkit.ChatColor;
import org.bukkit.World;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
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;
import java.io.File;
import java.io.IOException;
import java.util.Objects;
import java.util.UUID;
import static de.steev.bm.utils.Constants.*;
public class BetterMinecraft extends JavaPlugin implements Listener {
// Global Variables that might come helpfull later
public int playerInBed = 0;
public World world;
String version = "1.2";
// Custom Playerdata File
private File playerdata;
private FileConfiguration playerDataConfig;
private final String playerdatafilename = "playerdata.yml";
private static String prefix = ChatColor.GRAY + "[" + ChatColor.AQUA + "BetterMinecraft" + ChatColor.GRAY + "]";
private Config playerData = new Config(playerDataFilename, this);
private GameManager gameManager;
// Handles initialisation
public void onEnable() {
// Messaging
this.getLogger().info(prefix + ChatColor.WHITE + "Plugin Startet");
this.getLogger().info(prefix + ChatColor.WHITE + "Plugin Startup");
this.getLogger().info(prefix + ChatColor.WHITE + "Initializing Gamemanager");
gameManager = new GameManager(this);
this.saveDefaultConfig();
// Registers Events
this.getLogger().info(prefix + ChatColor.WHITE + "Lade Events");
this.getLogger().info(prefix + ChatColor.WHITE + "Load Events");
this.getServer().getPluginManager().registerEvents(new BedListener(this.gameManager), this);
this.getServer().getPluginManager().registerEvents(new KillListener(this.gameManager), this);
this.getServer().getPluginManager().registerEvents(new InteractListener(this.gameManager), this);
this.getServer().getPluginManager().registerEvents(new PrepareAnvilListener(this.gameManager), this);
this.getServer().getPluginManager().registerEvents(this, this);
this.getCommand("back").setExecutor(new back(this.gameManager));
Objects.requireNonNull(this.getCommand("back")).setExecutor(new back(this.gameManager));
// PlayerData
playerdata = new File(this.getDataFolder(), playerdatafilename);
playerDataConfig = YamlConfiguration.loadConfiguration(playerdata);
saveplayerdata();
try {
this.playerData.saveConfig(playerDataFilename);
} catch (IOException e) {
throw new RuntimeException(e);
}
// More Messaging
this.getLogger().info(ChatColor.AQUA + "Ich bin Fertig :D");
// More Messaging
this.getLogger().info(ChatColor.AQUA + "Startup complete :D");
}
@EventHandler
void onPlayerJoin(PlayerJoinEvent e) {
Player p = (Player) e.getPlayer();
UUID uuid = p.getUniqueId();
// prevent this allways resetting the job count
if (this.playerDataConfig.get(uuid + "." + version + ".read") == null) {
p.sendMessage("================= Better Minecraft " + version + " =================");
p.sendMessage("Command: /back eingefügt");
p.sendMessage("=====================================================");
this.playerDataConfig.set(uuid + ".name", p.getName());
this.playerDataConfig.set(uuid + "." + version + ".read", "true");
saveplayerdata();
}
}
void saveplayerdata() {
try {
playerDataConfig.save(playerdata);
} catch (IOException e) {
this.getLogger().warning("Unable to save " + playerdatafilename); // shouldn't really happen, but save
// throws the exception
if (this.playerData.readBooleanFromConfig(uuid + "." + Version + ".read")) {
p.sendMessage("================= Better Minecraft " + Version + " =================");
p.sendMessage("Amboss Kostengrenze entfernt");
p.sendMessage("=====================================================");
this.playerData.writeStringToConfig(uuid + ".name", p.getName());
this.playerData.writeStringToConfig(uuid + "." + Version + ".read", "true");
this.playerData.saveConfig(playerDataFilename);
}
} catch (ConfigEntryExceptions cee) {
this.getLogger().warning("reading config failed with error: " + cee.getMessage());
} catch (IOException ioe) {
throw new RuntimeException(ioe);
}
}
public FileConfiguration getPlayerDataConfig(){
return this.playerDataConfig;
}
public static String LoggerPrefix(){
return prefix;
}
@@ -96,4 +91,8 @@ public class BetterMinecraft extends JavaPlugin implements Listener {
// Even more Messaging
this.getLogger().info(ChatColor.AQUA + "Ich geh dann mal :c");
}
public FileConfiguration getPlayerDataConfig() {
return this.playerData.getConfig();
}
}

View File

@@ -17,8 +17,14 @@ public class back implements CommandExecutor {
@Override
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
if (!this.gameManager.getConfigManager().GetBool("back_command")) {
commandSender.sendMessage("back command ist nicht aktiv");
return false;
}
Player player = (Player) commandSender.getServer().getPlayer(commandSender.getName());
Location lastDeath;
try {
lastDeath = this.gameManager.getPlugin().getPlayerDataConfig().getLocation(player.getUniqueId() + ".death");
player.teleport(lastDeath);
@@ -27,6 +33,7 @@ public class back implements CommandExecutor {
} catch (Exception ex) {
commandSender.sendMessage("Tot nicht gefunden!");
}
return false;
}
}

View File

@@ -0,0 +1,29 @@
package de.steev.bm.Interaction;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.Repairable;
public class AnvilCalculator {
public static int getRepairCost(ItemStack item) {
if (item == null || item.getType().isAir()) return 0;
ItemMeta meta = item.getItemMeta();
if (meta instanceof Repairable) {
Repairable r = (Repairable) meta;
return r.getRepairCost(); // default 0 wenn nicht gesetzt
}
return 0;
}
public static ItemStack setRepairCost(ItemStack item, int cost) {
if (item == null || item.getType().isAir()) return item;
ItemMeta meta = item.getItemMeta();
if (meta instanceof Repairable) {
Repairable r = (Repairable) meta;
r.setRepairCost(cost);
item.setItemMeta(meta);
}
return item;
}
}

View File

@@ -36,9 +36,12 @@ public class replanting {
target.getLocation().getWorld().dropItem(loc, new ItemStack(item[0]));
}
for(int i = 0; i < amount[1]; i++) {
target.getLocation().getWorld().dropItem(loc, new ItemStack(item[1]));
if (amount.length > 1) {
for (int i = 0; i < amount[1]; i++) {
target.getLocation().getWorld().dropItem(loc, new ItemStack(item[1]));
}
}
crop.setAge(0);
target.setBlockData(crop);
}

View File

@@ -1,6 +1,5 @@
package de.steev.bm.Listener;
import de.steev.bm.BetterMinecraft;
import de.steev.bm.Manager.GameManager;
import org.bukkit.Bukkit;
import org.bukkit.World;
@@ -9,19 +8,21 @@ import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerBedEnterEvent;
import org.bukkit.event.player.PlayerBedLeaveEvent;
import static de.steev.bm.utils.Constants.prefix;
public class BedListener implements Listener {
private GameManager gameManager;
public BedListener(GameManager gameManager) {
gameManager.getPlugin().getLogger().info("Bed Listener Registered");
gameManager.getPlugin().getLogger().info(prefix + "Bed Listener Registered");
this.gameManager = gameManager;
}
@EventHandler // Adding to the Player Variable
public void onPlayerBedEnter(PlayerBedEnterEvent event) {
final World world = event.getPlayer().getWorld();
if(world.getTime() >= 13000 || world.getThunderDuration() > 0) {
if(world.getTime() >= 13000 || world.getThunderDuration() > 0 && this.gameManager.getConfigManager().GetBool("improved_bed")) {
this.gameManager.getPlugin().playerInBed++;
// Checks if enough Players (currentSleeping >= OnlinePlayerAmount/2) are Sleeping
if(this.gameManager.getPlugin().playerInBed >= (int)this.gameManager.getPlugin().getServer().getOnlinePlayers().size()/2) {
@@ -49,5 +50,4 @@ public class BedListener implements Listener {
this.gameManager.getPlugin().playerInBed = 0;
}
}
}

View File

@@ -11,17 +11,19 @@ import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import static de.steev.bm.utils.Constants.prefix;
public class InteractListener implements Listener {
private GameManager gameManager;
public InteractListener(GameManager gameManager){
gameManager.getPlugin().getLogger().info("Initializing Interaction Listener");
gameManager.getPlugin().getLogger().info(prefix + "Initializing Interaction Listener");
this.gameManager = gameManager;
}
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event){
if(event.getAction().equals(Action.RIGHT_CLICK_BLOCK)){
if(event.getAction().equals(Action.RIGHT_CLICK_BLOCK) && this.gameManager.getConfigManager().GetBool("replanting")){
/** the clicked block */
Block target = event.getClickedBlock();

View File

@@ -11,12 +11,14 @@ import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDeathEvent;
import java.util.UUID;
import static de.steev.bm.utils.Constants.prefix;
public class KillListener implements Listener {
private GameManager gameManager;
public KillListener(GameManager gameManager) {
gameManager.getPlugin().getLogger().info("Mob Death events Registered");
gameManager.getPlugin().getLogger().info(prefix + "Mob Death events Registered");
this.gameManager = gameManager;
}
@@ -29,12 +31,12 @@ public class KillListener implements Listener {
int[] amounts;
Material[] drops;
if(event.getEntity() instanceof Player){
if(event.getEntity() instanceof Player && this.gameManager.getConfigManager().GetBool("back_command")){
Location death = ((Player) event.getEntity()).getPlayer().getLocation();
UUID uuid = ((Player) event.getEntity()).getPlayer().getUniqueId();
this.gameManager.getPlugin().getPlayerDataConfig().set("" + uuid + ".death", death);
this.gameManager.getPlugin().getPlayerDataConfig().set(uuid + ".death", death);
} else if(event.getEntity() instanceof Animals) {
if(event.getEntity().toString() == "CraftPig"){
if(event.getEntity().toString() == "CraftPig" && this.gameManager.getConfigManager().GetBool("custom_drops")){
amounts = new int[]{ 2,2 };
drops = new Material[]{Material.LEATHER, Material.PORKCHOP};
Death.onAnimalDeath(amounts, drops, this.gameManager.getPlugin(), event);

View File

@@ -0,0 +1,32 @@
package de.steev.bm.Listener;
import de.steev.bm.BetterMinecraft;
import de.steev.bm.Manager.GameManager;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.PrepareAnvilEvent;
import org.bukkit.inventory.AnvilInventory;
import org.bukkit.inventory.view.AnvilView;
import static de.steev.bm.utils.Constants.prefix;
public class PrepareAnvilListener implements Listener {
private GameManager gameManager;
public PrepareAnvilListener(GameManager gameManager) {
gameManager.getPlugin().getLogger().info(prefix + "initializing Anvil CostCap fix");
this.gameManager = gameManager;
}
@EventHandler
public void onPrepare(PrepareAnvilEvent event) {
if (this.gameManager.getConfigManager().GetBool("anvil_fix")) {
AnvilView inv = event.getView();
this.gameManager.getPlugin().getLogger().info(prefix + "repaircost:" + inv.getRepairCost());
inv.setMaximumRepairCost(Integer.MAX_VALUE);
inv.getPlayer().sendMessage("repair cost: " + inv.getRepairCost());
inv.setRepairCost(inv.getRepairCost());
}
}
}

View File

@@ -0,0 +1,14 @@
package de.steev.bm.Manager;
public class ConfigManager {
private GameManager gameManager;
public ConfigManager(GameManager gameManager) {
this.gameManager = gameManager;
}
public boolean GetBool(String Key){
return gameManager.getPlugin().getConfig().getBoolean(Key);
}
}

View File

@@ -12,6 +12,7 @@ public class GameManager {
private BetterMinecraft plugin;
private RecipyManager recipyManager;
private PlayerManager playerManager;
private ConfigManager configManager;
/**
* initilizes the Gamemanager and all systems beneath it
@@ -26,20 +27,22 @@ public class GameManager {
this.recipyManager = new RecipyManager(this);
this.playerManager = new PlayerManager(this);
this.configManager = new ConfigManager(this);
this.plugin.getLogger().info("registring Recipies");
this.plugin.getLogger().info("saddle");
char[] s_ing = { 'L', 'S', 'I', 'W' };
String[] s_rec = { "LLL", "SWS", "I I" };
Material[] s_mat = { Material.LEATHER, Material.STRING, Material.IRON_INGOT, Material.WOOL};
this.recipyManager.RegisterNew(s_ing, s_mat, s_rec, 1, Material.SADDLE, "Saddle");
this.plugin.getLogger().info("String");
char[] w_ing = { 'W', 'F', };
String[] w_rec = { " W ", "WFW", " W " };
Material[] w_mat = { Material.WHITE_WOOL, Material.FLINT };
this.recipyManager.RegisterNew(w_ing, w_mat, w_rec, 4, Material.STRING, "String");
if (this.configManager.GetBool("custom_recipes")) {
this.plugin.getLogger().info("registring Recipies");
this.plugin.getLogger().info("saddle");
char[] s_ing = {'L', 'S', 'I', 'W'};
String[] s_rec = {"LLL", "SWS", "I I"};
Material[] s_mat = {Material.LEATHER, Material.STRING, Material.IRON_INGOT, Material.WHITE_WOOL};
this.recipyManager.RegisterNew(s_ing, s_mat, s_rec, 1, Material.SADDLE, "Saddle");
this.plugin.getLogger().info("String");
char[] w_ing = {'W', 'F',};
String[] w_rec = {" W ", "WFW", " W "};
Material[] w_mat = {Material.WHITE_WOOL, Material.FLINT};
this.recipyManager.RegisterNew(w_ing, w_mat, w_rec, 4, Material.STRING, "String");
}
}
public BetterMinecraft getPlugin(){
@@ -53,5 +56,9 @@ public class GameManager {
public PlayerManager getPlayerManager() {
return playerManager;
}
public ConfigManager getConfigManager() {
return configManager;
}
}

View File

@@ -0,0 +1,60 @@
package de.steev.bm.utils;
import de.steev.bm.Manager.GameManager;
import org.bukkit.entity.Player;
enum ChangelogType {
SystemChangeLog,
CustomChangelog
}
public class Changelog {
private GameManager plugin;
public Changelog(GameManager plugin) {
this.plugin = plugin;
}
/**
* handles getting changelog and sending it to the player
* @param player the receiving player
*/
public void SendChangelog(Player player) {
//player.sendMessage(createChangelog());
}
/**
* handles checking the playerdata if a player already saw the changelog
* @param player the player to lookup
* @return boolean which tells whether a player has seen the changelog or not
*/
private boolean hasPlayerSeenChangelog(ChangelogType changelogType, Player player) {
// TODO: read from header what version the changelog is for
// TODO: read from playerdata.yml if the player has seen the changelog for that type
// TODO: return found result
return false;
}
/***
* reads the set changlog file
* @return the resulting changelog as string
*/
private String createChangelog(ChangelogType changelogType) {
// TODO: FETCH from
/*switch (changelogType) {
case SystemChangeLog:
// TODO: get changelog url from config
// TODO: fetch version changelog from git
// TODO: proccess changelog
break;
case CustomChangelog:
// TODO: fetch changes from changes.txt found in plugin folder or from configured destination
// TODO: proccess changelog
break;
}*/
return "";
}
}

View File

@@ -0,0 +1,72 @@
package de.steev.bm.utils;
import de.steev.bm.BetterMinecraft;
import de.steev.bm.utils.exceptions.ConfigEntryExceptions;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
import java.io.IOException;
import static de.steev.bm.utils.Constants.playerDataFilename;
public class Config {
private String name;
private File configFile;
private FileConfiguration fileConfiguration;
private BetterMinecraft plugin;
public Config(String name, BetterMinecraft plugin) {
this.name = name;
this.plugin = plugin;
configFile = new File(this.plugin.getDataFolder(), playerDataFilename);
fileConfiguration = YamlConfiguration.loadConfiguration(configFile);
}
public void saveConfig(String name) throws IOException {
try {
fileConfiguration.save(configFile);
} catch (IOException e) {
this.plugin.getLogger().warning("Unable to save " + playerDataFilename); // shouldn't really happen, but save
// throws the exception
throw e;
}
}
public void writeStringToConfig(String path, String value) {
this.fileConfiguration.set(path, value);
}
public String readStringFromConfig(String path) throws ConfigEntryExceptions {
if (this.fileConfiguration.get(path) == null) {
throw new ConfigEntryExceptions("entry at: " + path + " found null");
}
return this.fileConfiguration.getString(path);
}
public int readIntFromConfig(String path) throws ConfigEntryExceptions {
if (this.fileConfiguration.get(path) == null) {
throw new ConfigEntryExceptions("entry at: " + path + " found null");
}
return this.fileConfiguration.getInt(path);
}
public boolean readBooleanFromConfig(String path) throws ConfigEntryExceptions {
if (this.fileConfiguration.get(path) == null) {
throw new ConfigEntryExceptions("entry at: " + path + " found null");
}
return this.fileConfiguration.getBoolean(path);
}
public FileConfiguration getConfig() {
return this.fileConfiguration;
}
public String getName() {
return this.name;
}
}

View File

@@ -0,0 +1,9 @@
package de.steev.bm.utils;
import org.bukkit.ChatColor;
public class Constants {
public static final String prefix = ChatColor.GRAY + "[" + ChatColor.AQUA + "BetterMinecraft" + ChatColor.GRAY + "]";
public static final String playerDataFilename = "playerdata.yml";
public static final String Version = "1.2.2";
}

View File

@@ -0,0 +1,9 @@
package de.steev.bm.utils.exceptions;
public class ConfigEntryExceptions extends Exception {
public ConfigEntryExceptions() {}
public ConfigEntryExceptions(String message) {
super(message);
}
}

View File

@@ -0,0 +1,17 @@
# sets minimum players in bed to 50% of the server instead of requiring all players to be in bed
improved_bed: true
# fixes anvil cost beeing to expensive after 40 level
anvil_fix: true
# adds additional drops to some mobds
custom_drops: true
# adds custom crafting recipes
custom_recipes: true
# enables forge like replanting
replanting: true
# enables /back command
back_command: true

View File

@@ -1,7 +1,7 @@
name: BetterMinecraft
main: de.steev.bm.main
version: 1.0
api-version: 1.17
main: de.steev.bm.BetterMinecraft
version: 1.2.2-b2
api-version: 1.21
commands:
back:
description: "teleports players back to their deathpoint"