17 Commits

Author SHA1 Message Date
256224e144 Merge pull request 'Testing' (#33) from Testing into Release
Reviewed-on: #33
2023-10-17 00:50:28 +02:00
02856bc49a Merge pull request 'fixed bug that prevented plants from resetting age' (#32) from config_support into Testing
Reviewed-on: #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: #31
2023-10-07 03:12:49 +02:00
6ac6455f2d added config support 2023-10-07 03:09:28 +02:00
df2dd2e28f Merge pull request 'main' (#29) from main into Testing
Reviewed-on: #29
2023-10-04 18:30:15 +02:00
aa152599bb Merge pull request '.gitea/workflows/release.yml aktualisiert' (#23) from main into Release
Some checks failed
Build and Release Minecraft Plugin / build (push) Failing after 4m0s
Build and Release Minecraft Plugin / release (push) Has been skipped
Reviewed-on: #23
2023-10-03 22:50:44 +02:00
3e7dafcabe Merge pull request '.gitea/workflows/release.yml aktualisiert' (#22) from main into Release
Some checks failed
Build and Release Minecraft Plugin / build (push) Failing after 2m26s
Build and Release Minecraft Plugin / release (push) Has been skipped
Reviewed-on: #22
2023-10-03 22:45:42 +02:00
651b02200f Merge pull request '.gitea/workflows/release.yml aktualisiert' (#21) from main into Release
Some checks reported warnings
Build and Release Minecraft Plugin / release (push) Has been cancelled
Build and Release Minecraft Plugin / build (push) Has been cancelled
Reviewed-on: #21
2023-10-03 22:34:36 +02:00
14543e878f Merge pull request '.gitea/workflows/release.yml aktualisiert' (#20) from main into Release
All checks were successful
Build and Release Minecraft Plugin / build (push) Successful in 2m58s
Build and Release Minecraft Plugin / release (push) Successful in 12s
Reviewed-on: #20
2023-10-03 20:16:08 +02:00
099431df0f Merge pull request 'fixed naming issues' (#19) from main into Release
Some checks failed
Build and Release Minecraft Plugin / build (push) Failing after 3m37s
Build and Release Minecraft Plugin / release (push) Successful in 12s
Reviewed-on: #19
2023-10-03 19:58:25 +02:00
fb9f5db652 Merge pull request 'Correction in pom.xml' (#18) from main into Release
All checks were successful
Build and Release Minecraft Plugin / build (push) Successful in 2m25s
Build and Release Minecraft Plugin / release (push) Successful in 13s
Reviewed-on: #18
2023-10-03 19:51:56 +02:00
21ccb2bf94 Merge pull request '.gitea/workflows/release.yml aktualisiert' (#17) from main into Release
All checks were successful
Build and Release Minecraft Plugin / build (push) Successful in 2m32s
Build and Release Minecraft Plugin / release (push) Successful in 17s
Reviewed-on: #17
2023-10-03 19:43:51 +02:00
552267019a Merge pull request '.gitea/workflows/release.yml aktualisiert' (#16) from main into Release
Some checks failed
Build and Release Minecraft Plugin / build (push) Failing after 1m23s
Build and Release Minecraft Plugin / release (push) Has been skipped
Reviewed-on: #16
2023-10-03 19:39:06 +02:00
d2eb8e6c71 Merge pull request '.gitea/workflows/release.yml aktualisiert' (#15) from main into Release
Some checks failed
Build and Release Minecraft Plugin / build (push) Failing after 51s
Build and Release Minecraft Plugin / release (push) Has been skipped
Reviewed-on: #15
2023-10-03 19:36:05 +02:00
c9367a2098 Merge pull request '.gitea/workflows/release.yml aktualisiert' (#14) from main into Release
Some checks failed
Build and Release Minecraft Plugin / build (push) Failing after 45s
Build and Release Minecraft Plugin / release (push) Has been skipped
Reviewed-on: #14
2023-10-03 19:34:22 +02:00
3f33d2efc2 Merge pull request 'main' (#13) from main into Release
Some checks failed
Build and Release Minecraft Plugin / build (push) Failing after 52s
Build and Release Minecraft Plugin / release (push) Has been skipped
Reviewed-on: #13
2023-10-03 19:31:07 +02:00
10 changed files with 56 additions and 20 deletions

View File

@ -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

@ -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");

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

@ -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;
@ -21,7 +20,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) {
@ -49,5 +48,4 @@ public class BedListener implements Listener {
this.gameManager.getPlugin().playerInBed = 0;
}
}
}

View File

@ -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();

View File

@ -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);

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.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;
}
}

View File

@ -0,0 +1,5 @@
improved_bed: true
custom_drops: true
custom_recipes: true
replanting: true
back_command: true