Merge pull request #15 from tylermurphy534/1.3.1

1.3.1
This commit is contained in:
Tyler Murphy 2021-12-21 11:31:00 -05:00 committed by GitHub
commit a5a7af37fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 274 additions and 84 deletions

128
.github/CODE_OF_CONDUCT.md vendored Normal file
View file

@ -0,0 +1,128 @@
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
tylermurphy543@gmail.com.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series
of actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within
the community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.

13
.github/CONTRIBUTING.md vendored Normal file
View file

@ -0,0 +1,13 @@
## Contributing Guidelines
- Do not send any pull requests to the master branch
- Any pull requests sent to master will be closed
- Send pull requets to the current beta branch (usually named as an unreleased version)
- Please tell us why you think this change is nessessary
- We dont want to spend lots of time browsing through your code changes
- Describe your changes
- Do not repoen a pull request if we closed it for not being a nessary feature
- Do not change credits in any of the files
- If making a new language file, follow the local naming convencion
- localization-[LANGUAGE](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes#)_[TERROTORY](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements).yml. You can find the 2 letter codes in the links.
- Common sense, please...
- File subject to change in the future

33
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View file

@ -0,0 +1,33 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug report
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**System Info (please complete the following information):**
- OS: [e.g. Windows/Linux]
- Server Host [e.g. Apex/Custom]
- MC Version [e.g. 1.17/1.18]
- Plugin Version [e.g. 1.3.0/1.3.1 BETA]
**Additional context**
Add any other context about the problem here.

View file

@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: new plugin feature
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

11
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,11 @@
**Describe the change**
A clear and concise description of what the changes are.
**Expected behavior**
A clear and concise description of what your changes are going to do.
**Screenshots**
If applicable, add screenshots to help explain your changes.
**Additional context**
Add any other context about the pull request here.

15
.github/SECURITY.md vendored Normal file
View file

@ -0,0 +1,15 @@
# Security Policy
## Supported Versions
| Version | Supported |
| ------- | ------------------ |
| 1.3.1 | :white_check_mark: |
| 1.3.0 | :white_check_mark: |
| 1.2.0 | :x: |
## Reporting a Vulnerability
If you Find any security vulnerabilitys in the plugin, please contact me at
tylermurphy534@gmail.com IMMEDITALLY. All requests will be taken seriously.
Tell me your plugin version, as non supported versions will be ignored.

View file

@ -3,8 +3,6 @@ name: Beta
on: on:
push: push:
branches-ignore: [ master ] branches-ignore: [ master ]
pull_request:
branches-ignore: [ master ]
jobs: jobs:
build: build:

View file

@ -3,8 +3,6 @@ name: Release
on: on:
push: push:
branches: [ master ] branches: [ master ]
pull_request:
branches: [ master ]
jobs: jobs:
build: build:

20
README.md Normal file
View file

@ -0,0 +1,20 @@
Kenshins Hide And Seek
======
Highly customizable hide and seek plugin
How To
-----------
All Information on how to setup the plugin has
been moved to the github WIKI.
Compilation
-----------
We use maven to handle our dependencies.
* Install [Maven 3](http://maven.apache.org/download.html)
* Clone this repo and: `mvn clean install`

View file

@ -40,11 +40,4 @@
<version>4.7.0</version> <version>4.7.0</version>
</dependency> </dependency>
</dependencies> </dependencies>
<distributionManagement>
<repository>
<id>github</id>
<name>GitHub Packages</name>
<url>https://maven.pkg.github.com/tylermurphy534/KenshinsHideAndSeek</url>
</repository>
</distributionManagement>
</project> </project>

View file

@ -28,6 +28,7 @@ public class SetExitLocation implements ICommand {
newExitPosition.setX(player.getLocation().getBlockX()); newExitPosition.setX(player.getLocation().getBlockX());
newExitPosition.setY(player.getLocation().getBlockY()); newExitPosition.setY(player.getLocation().getBlockY());
newExitPosition.setZ(player.getLocation().getBlockZ()); newExitPosition.setZ(player.getLocation().getBlockZ());
exitWorld = player.getLocation().getWorld().getName();
exitPosition = newExitPosition; exitPosition = newExitPosition;
sender.sendMessage(messagePrefix + message("EXIT_SPAWN")); sender.sendMessage(messagePrefix + message("EXIT_SPAWN"));
addToConfig("spawns.exit.x", exitPosition.getX()); addToConfig("spawns.exit.x", exitPosition.getX());

View file

@ -28,6 +28,7 @@ public class SetLobbyLocation implements ICommand {
newLobbyPosition.setX(player.getLocation().getBlockX()); newLobbyPosition.setX(player.getLocation().getBlockX());
newLobbyPosition.setY(player.getLocation().getBlockY()); newLobbyPosition.setY(player.getLocation().getBlockY());
newLobbyPosition.setZ(player.getLocation().getBlockZ()); newLobbyPosition.setZ(player.getLocation().getBlockZ());
lobbyWorld = player.getLocation().getWorld().getName();
lobbyPosition = newLobbyPosition; lobbyPosition = newLobbyPosition;
sender.sendMessage(messagePrefix + message("LOBBY_SPAWN")); sender.sendMessage(messagePrefix + message("LOBBY_SPAWN"));
addToConfig("spawns.lobby.x", lobbyPosition.getX()); addToConfig("spawns.lobby.x", lobbyPosition.getX());

View file

@ -34,6 +34,7 @@ public class SetSpawnLocation implements ICommand {
sender.sendMessage(errorPrefix + message("WORLDBORDER_POSITION")); sender.sendMessage(errorPrefix + message("WORLDBORDER_POSITION"));
return; return;
} }
spawnWorld = player.getLocation().getWorld().getName();
spawnPosition = newSpawnPosition; spawnPosition = newSpawnPosition;
sender.sendMessage(messagePrefix + message("GAME_SPAWN")); sender.sendMessage(messagePrefix + message("GAME_SPAWN"));
addToConfig("spawns.game.x", spawnPosition.getX()); addToConfig("spawns.game.x", spawnPosition.getX());

View file

@ -13,9 +13,11 @@ public class ConfigManager {
private File file; private File file;
private YamlConfiguration config,defaultConfig; private YamlConfiguration config,defaultConfig;
private String defaultFilename;
public ConfigManager(String filename){ public ConfigManager(String filename){
this.file = new File(Main.plugin.getDataFolder(), filename); this.file = new File(Main.plugin.getDataFolder(), filename);
this.defaultFilename = file.getName();
if(!file.exists()){ if(!file.exists()){
saveDefaultConfiguration(); saveDefaultConfiguration();
@ -33,6 +35,8 @@ public class ConfigManager {
} }
public ConfigManager(String filename, String defaultFilename){ public ConfigManager(String filename, String defaultFilename){
this.defaultFilename = defaultFilename;
this.file = new File(Main.plugin.getDataFolder(), filename); this.file = new File(Main.plugin.getDataFolder(), filename);
if(!file.exists()){ if(!file.exists()){
@ -99,9 +103,14 @@ public class ConfigManager {
config.set(path, defaultConfig.get(path)); config.set(path, defaultConfig.get(path));
} }
public void resetConfig(){ public void resetFile(String newDefaultFilename){
config = defaultConfig; this.defaultFilename = newDefaultFilename;
saveConfig();
InputStream input = Main.plugin.getResource(defaultFilename);
InputStreamReader reader = new InputStreamReader(input);
this.config = YamlConfiguration.loadConfiguration(reader);
this.defaultConfig = YamlConfiguration.loadConfiguration(reader);
} }
public boolean getBoolean(String path){ public boolean getBoolean(String path){
@ -128,7 +137,7 @@ public class ConfigManager {
public void saveConfig(){ public void saveConfig(){
try { try {
InputStream is = Main.plugin.getResource(file.getName()); InputStream is = Main.plugin.getResource(defaultFilename);
StringBuilder textBuilder = new StringBuilder(); StringBuilder textBuilder = new StringBuilder();
Reader reader = new BufferedReader(new InputStreamReader(is, Charset.forName(StandardCharsets.UTF_8.name()))); Reader reader = new BufferedReader(new InputStreamReader(is, Charset.forName(StandardCharsets.UTF_8.name())));
int c = 0; int c = 0;
@ -144,15 +153,15 @@ public class ConfigManager {
int i = 0; int i = 0;
for(String part : parts) { for(String part : parts) {
if(i == 0) { if(i == 0) {
index = yamlString.indexOf(part, index); index = yamlString.indexOf(part+":", index);
} else { } else {
index = yamlString.indexOf(" " + part, index); index = yamlString.indexOf(" " + part+":", index);
index++; index++;
} }
i++; i++;
if(index == -1) break; if(index == -1) break;
} }
if(index == -1) continue;; if(index < 10) continue;;
int start = yamlString.indexOf(' ', index); int start = yamlString.indexOf(' ', index);
int end = yamlString.indexOf('\n', index); int end = yamlString.indexOf('\n', index);
if(end == -1) end = yamlString.length(); if(end == -1) end = yamlString.length();
@ -160,8 +169,9 @@ public class ConfigManager {
if(entry.getValue() instanceof String){ if(entry.getValue() instanceof String){
replace = "\"" + replace + "\""; replace = "\"" + replace + "\"";
} }
System.out.println(entry.getKey() + " " + index + " " + start + " " + end);
StringBuilder builder = new StringBuilder(yamlString); StringBuilder builder = new StringBuilder(yamlString);
builder.replace(start+1, end == -1 ? yamlString.length() : end, replace); builder.replace(start+1, end, replace);
yamlString = builder.toString(); yamlString = builder.toString();
} }
} }

View file

@ -28,12 +28,13 @@ public class Localization {
manager.reset("version"); manager.reset("version");
} }
String SELECTED_LOCAL = manager.getString("local"); String SELECTED_LOCAL = manager.getString("type");
if(!SELECTED_LOCAL.equals(Config.local)){ if(SELECTED_LOCAL == null){
manager.resetConfig(); manager.reset("type");
} else if(!SELECTED_LOCAL.equals(Config.local)){
manager.resetFile("lang"+File.separator+"localization_"+Config.local+".yml");
} }
manager.saveConfig(); manager.saveConfig();
for(String key : manager.getConfigurationSection("Localization").getKeys(false)) { for(String key : manager.getConfigurationSection("Localization").getKeys(false)) {

View file

@ -36,9 +36,6 @@ autoJoin: false
# default: false # default: false
teleportToExit: false teleportToExit: false
countdown:
# The worldborder closes every interval, which is evey [delay] in minutes. # The worldborder closes every interval, which is evey [delay] in minutes.
# Thw worldborder starts at [size], and decreases 100 blocks every interval. # Thw worldborder starts at [size], and decreases 100 blocks every interval.
# x & z are the center location. [enabled] is whenever the border is enabled. # x & z are the center location. [enabled] is whenever the border is enabled.

View file

@ -46,6 +46,7 @@ Localization:
SETUP_EXIT: "&c&l- &fTeleport-Position für das Spielende festlegen mit /hs setexit" SETUP_EXIT: "&c&l- &fTeleport-Position für das Spielende festlegen mit /hs setexit"
SETUP_SAVEMAP: "&c&l- &fHide and Seek Weltkarte speichern mit /hs savemap (nach /hs setspawn)" SETUP_SAVEMAP: "&c&l- &fHide and Seek Weltkarte speichern mit /hs savemap (nach /hs setspawn)"
SETUP_COMPLETE: "Alles eingerichtet! Hide and Seek ist spielbereit." SETUP_COMPLETE: "Alles eingerichtet! Hide and Seek ist spielbereit."
SETUP_BOUNDS: "&c&l- &fBitte legen Sie Spielgrenzen in 2 gegenüberliegenden Ecken der Spielkarte fest, /hs setbounds"
GAME_SPAWN: "Teleport-Position für Spielbeginn festgelegt" GAME_SPAWN: "Teleport-Position für Spielbeginn festgelegt"
LOBBY_SPAWN: "Teleport-Position für Lobby festgelegt" LOBBY_SPAWN: "Teleport-Position für Lobby festgelegt"
EXIT_SPAWN: "Teleport-Position für Spielende festgelegt" EXIT_SPAWN: "Teleport-Position für Spielende festgelegt"
@ -56,5 +57,10 @@ Localization:
STOP: "Das Spiel wurde gestoppt." STOP: "Das Spiel wurde gestoppt."
HIDERS_SUBTITLE: "Verstecke dich gut vor den Seekern!" HIDERS_SUBTITLE: "Verstecke dich gut vor den Seekern!"
SEEKERS_SUBTITLE: "Finde alle Hider!" SEEKERS_SUBTITLE: "Finde alle Hider!"
BOUNDS_WRONG_WORLD: "Führe diesen Befehl bitte in der Spielwelt aus."
BOUNDS: "Grenzen erfolgreich an dieser Position gesetzt. ({AMOUNT}/2)"
NOT_AT_ZERO: "Bitte nicht an einer Position setzen, die eine Koordinate bei 0 enthält."
# DO NOT EDIT IT OR IT MAY BREAK OR RESET FILE
version: 2
type: "de-DE" type: "de-DE"

View file

@ -61,4 +61,6 @@ Localization:
BOUNDS: "Successfully set bounds at this position ({AMOUNT}/2)." BOUNDS: "Successfully set bounds at this position ({AMOUNT}/2)."
NOT_AT_ZERO: "Please do not set at a location containing a coordinate at 0." NOT_AT_ZERO: "Please do not set at a location containing a coordinate at 0."
# DO NOT EDIT IT OR IT MAY BREAK OR RESET FILE
version: 2
type: "en-US" type: "en-US"

View file

@ -1,58 +0,0 @@
Localization:
COMMAND_PLAYER_ONLY: "This command can only be run as a player."
COMMAND_NOT_ALLOWED: "You are not allowed to run this command."
COMMAND_ERROR: "An internal error has occurred."
GAME_PLAYER_DEATH: "&c{PLAYER}&f was killed."
GAME_PLAYER_FOUND: "&e{PLAYER}&f was found and became a seeker."
GAME_PLAYER_FOUND_BY: "&e{PLAYER}&f was found by &c{PLAYER}&f and became a seeker."
GAME_GAMEOVER_HIDERS_FOUND: "All hiders have been found."
GAME_GAMEOVER_SEEKERS_QUIT: "All seekers have quit."
GAME_GAMEOVER_TIME: "Seekers ran out of time. Hiders win!"
GAME_SETUP: "Game is not setup. Run /hs setup to see what you need to do."
GAME_INGAME: "You are already in the lobby/game."
GAME_NOT_INGAME: "You are not in a lobby/game."
GAME_INPROGRESS: "There is currently a game in progress."
GAME_NOT_INPROGRESS: "There is no game in progress."
GAME_JOIN: "{PLAYER} has joined the HideAndSeek lobby."
GAME_JOIN_SPECTATOR: "You have joined mid game and are now a spectator."
GAME_LEAVE: "{PLAYER} has left the HideAndSeek lobby."
CONFIG_RELOAD: "Reloaded the config."
MAPSAVE_INPROGRESS: "Map save is currently in progress. Try again later."
MAPSAVE_START: "Starting map save."
MAPSAVE_WARNING: "All commands will be disabled when the save is in progress. Do not turn off the server."
MAPSAVE_END: "Map save complete."
MAPSAVE_ERROR: "Couldn't find current map."
WORLDBORDER_DISABLE: "Disabled world border."
WORLDBORDER_INVALID_INPUT: "Invalid integer {AMOUNT}."
WORLDBORDER_MIN_SIZE: "World border cannot be smaller than 100 blocks."
WORLDBORDER_POSITION: "Spawn position must be 100 from world border center."
WORLDBORDER_ENABLE: "Set border center to current location, size to {AMOUNT}, and delay to {AMOUNT}."
WORLDBORDER_DECREASING: "World border decreasing by 100 blocks over the next 30s."
TAUNTED: "$c$oOh no! You have been chosen to be taunted."
TAUNT: "A random hider will be taunted in the next 30s."
TAUNT_ACTIVATE: "Taunt has been activated."
ERROR_GAME_SPAWN: "Please set game spawn location first"
SETUP: "&f&lThe following is needed for setup..."
SETUP_GAME: "&c&l- &fGame spawn isn't set, /hs setspawn"
SETUP_LOBBY: "&c&l- &fLobby spawn isn't set, /hs setlobby"
SETUP_EXIT: "&c&l- &fQuit/exit teleport location isn't set, /hs setexit"
SETUP_SAVEMAP: "&c&l- &fHide and seek map isn't saved, /hs savemap (after /hs setspawn)"
SETUP_BOUNDS: "&c&l- &fPlease set game bounds in 2 opposite corners of the game map, /hs setbounds"
SETUP_COMPLETE: "Everything is setup and ready to go!"
GAME_SPAWN: "Set game spawn position to current location"
LOBBY_SPAWN: "Set lobby position to current location"
EXIT_SPAWN: "Set exit position to current location"
START_MIN_PLAYERS: "You must have at least {AMOUNT} players to start."
START_INVALID_NAME: "Invalid player: {PLAYER}."
START_COUNTDOWN: "Hiders have {AMOUNT} seconds to hide!"
START: "Attention SEEKERS, its time to fin the hiders!"
STOP: "Game has been force stopped."
HIDERS_SUBTITLE: "Hide away from the seekers"
SEEKERS_SUBTITLE: "Eliminate all hiders"
BOUNDS_WRONG_WORLD: "Please run this command in the game world."
BOUNDS: "Successfully set bounds at this position ({AMOUNT}/2)."
NOT_AT_ZERO: "Please do not set at a location containing a coordinate at 0."
# DO NOT EDIT IT OR IT MAY BREAK OR RESET FILE
version: 2
type: "en-US"