From 6743f297b28e029a4b6c74c8bdbc03a479f32066 Mon Sep 17 00:00:00 2001 From: steev Date: Wed, 4 Oct 2023 18:33:21 +0200 Subject: [PATCH 1/6] HOTFIX: changed false material from WOOL -> WHITE_WOOL --- src/main/java/de/steev/bm/Manager/GameManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/de/steev/bm/Manager/GameManager.java b/src/main/java/de/steev/bm/Manager/GameManager.java index 916f185..7a22b36 100644 --- a/src/main/java/de/steev/bm/Manager/GameManager.java +++ b/src/main/java/de/steev/bm/Manager/GameManager.java @@ -31,7 +31,7 @@ public class GameManager { 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}; + 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"); -- 2.49.0 From 63ffe0fe2b6fc1bae94bf552a0f4aed90305ca19 Mon Sep 17 00:00:00 2001 From: steev Date: Wed, 4 Oct 2023 18:37:07 +0200 Subject: [PATCH 2/6] HOTFIX: changed plugin.yml main class --- src/main/resources/plugin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 6e61eb1..3515651 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: BetterMinecraft -main: de.steev.bm.main +main: de.steev.bm.BetterMinecraft version: 1.0 api-version: 1.17 commands: -- 2.49.0 From 8c83b7ddb6a03fcdfc6a95cdc5cc73b22ce0e666 Mon Sep 17 00:00:00 2001 From: Steev Date: Wed, 4 Oct 2023 19:07:10 +0200 Subject: [PATCH 3/6] README.md aktualisiert --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/README.md b/README.md index b8fbefd..134fb06 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,26 @@ # 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 \ No newline at end of file -- 2.49.0 From 137a39e430e7881418631d625ca6717bcf6f19c8 Mon Sep 17 00:00:00 2001 From: Steev Date: Wed, 4 Oct 2023 19:08:46 +0200 Subject: [PATCH 4/6] README.md aktualisiert --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 134fb06..292bc29 100644 --- a/README.md +++ b/README.md @@ -17,10 +17,10 @@ Once the testing phase is over and now reports come in the feature will be pulle 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) +### 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 \ No newline at end of file -- 2.49.0 From 0fe5ce24a8ff2fc9953b69b29b8adb115a3aff8b Mon Sep 17 00:00:00 2001 From: Steev Date: Wed, 4 Oct 2023 19:09:02 +0200 Subject: [PATCH 5/6] README.md aktualisiert --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 292bc29..7223d1b 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ In order to contribute you need to do the following things 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 -- 2.49.0 From 6ac6455f2dba05b3e694c451275fff20999cdbe3 Mon Sep 17 00:00:00 2001 From: steev Date: Sat, 7 Oct 2023 03:09:28 +0200 Subject: [PATCH 6/6] added config support --- pom.xml | 1 + .../java/de/steev/bm/BetterMinecraft.java | 1 + src/main/java/de/steev/bm/Commands/back.java | 7 +++++ .../de/steev/bm/Listener/BedListener.java | 2 +- .../steev/bm/Listener/InteractListener.java | 2 +- .../de/steev/bm/Listener/KillListener.java | 4 +-- .../de/steev/bm/Manager/ConfigManager.java | 14 +++++++++ .../java/de/steev/bm/Manager/GameManager.java | 31 ++++++++++++------- src/main/resources/config.yml | 5 +++ 9 files changed, 51 insertions(+), 16 deletions(-) create mode 100644 src/main/java/de/steev/bm/Manager/ConfigManager.java create mode 100644 src/main/resources/config.yml diff --git a/pom.xml b/pom.xml index 84ef005..1808667 100644 --- a/pom.xml +++ b/pom.xml @@ -37,6 +37,7 @@ ${project.basedir}/src/main/resources plugin.yml + config.yml diff --git a/src/main/java/de/steev/bm/BetterMinecraft.java b/src/main/java/de/steev/bm/BetterMinecraft.java index 7a92030..4d6af9e 100644 --- a/src/main/java/de/steev/bm/BetterMinecraft.java +++ b/src/main/java/de/steev/bm/BetterMinecraft.java @@ -41,6 +41,7 @@ public class BetterMinecraft extends JavaPlugin implements Listener { this.getLogger().info(prefix + ChatColor.WHITE + "Plugin Startet"); this.getLogger().info(prefix + ChatColor.WHITE + "Initializing Gamemanager"); gameManager = new GameManager(this); + this.saveDefaultConfig(); // Registers Events this.getLogger().info(prefix + ChatColor.WHITE + "Lade Events"); diff --git a/src/main/java/de/steev/bm/Commands/back.java b/src/main/java/de/steev/bm/Commands/back.java index 4a16be8..99d3f93 100644 --- a/src/main/java/de/steev/bm/Commands/back.java +++ b/src/main/java/de/steev/bm/Commands/back.java @@ -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; } } diff --git a/src/main/java/de/steev/bm/Listener/BedListener.java b/src/main/java/de/steev/bm/Listener/BedListener.java index adf6d9b..56bee62 100644 --- a/src/main/java/de/steev/bm/Listener/BedListener.java +++ b/src/main/java/de/steev/bm/Listener/BedListener.java @@ -21,7 +21,7 @@ public class BedListener implements Listener { @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) { diff --git a/src/main/java/de/steev/bm/Listener/InteractListener.java b/src/main/java/de/steev/bm/Listener/InteractListener.java index 8054c85..d14808c 100644 --- a/src/main/java/de/steev/bm/Listener/InteractListener.java +++ b/src/main/java/de/steev/bm/Listener/InteractListener.java @@ -21,7 +21,7 @@ public class InteractListener implements Listener { @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(); diff --git a/src/main/java/de/steev/bm/Listener/KillListener.java b/src/main/java/de/steev/bm/Listener/KillListener.java index ca01c18..cccfe23 100644 --- a/src/main/java/de/steev/bm/Listener/KillListener.java +++ b/src/main/java/de/steev/bm/Listener/KillListener.java @@ -29,12 +29,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); } 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); diff --git a/src/main/java/de/steev/bm/Manager/ConfigManager.java b/src/main/java/de/steev/bm/Manager/ConfigManager.java new file mode 100644 index 0000000..1812f37 --- /dev/null +++ b/src/main/java/de/steev/bm/Manager/ConfigManager.java @@ -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); + } +} diff --git a/src/main/java/de/steev/bm/Manager/GameManager.java b/src/main/java/de/steev/bm/Manager/GameManager.java index 7a22b36..ae43b07 100644 --- a/src/main/java/de/steev/bm/Manager/GameManager.java +++ b/src/main/java/de/steev/bm/Manager/GameManager.java @@ -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.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"); + 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; + } } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml new file mode 100644 index 0000000..896d463 --- /dev/null +++ b/src/main/resources/config.yml @@ -0,0 +1,5 @@ +improved_bed: true +custom_drops: true +custom_recipes: true +replanting: true +back_command: true \ No newline at end of file -- 2.49.0