Compare commits
	
		
			17 Commits
		
	
	
		
			bugfix/bac
			...
			Release
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 256224e144 | |||
| 02856bc49a | |||
| d9cfdb218e | |||
| 300a1bf67c | |||
| 6ac6455f2d | |||
| df2dd2e28f | |||
| aa152599bb | |||
| 3e7dafcabe | |||
| 651b02200f | |||
| 14543e878f | |||
| 099431df0f | |||
| fb9f5db652 | |||
| 21ccb2bf94 | |||
| 552267019a | |||
| d2eb8e6c71 | |||
| c9367a2098 | |||
| 3f33d2efc2 | 
							
								
								
									
										1
									
								
								pom.xml
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								pom.xml
									
									
									
									
									
								
							@ -37,6 +37,7 @@
 | 
				
			|||||||
        <directory>${project.basedir}/src/main/resources</directory>
 | 
					        <directory>${project.basedir}/src/main/resources</directory>
 | 
				
			||||||
        <includes>
 | 
					        <includes>
 | 
				
			||||||
          <include>plugin.yml</include>
 | 
					          <include>plugin.yml</include>
 | 
				
			||||||
 | 
					          <include>config.yml</include>
 | 
				
			||||||
        </includes>
 | 
					        </includes>
 | 
				
			||||||
      </resource>
 | 
					      </resource>
 | 
				
			||||||
    </resources>
 | 
					    </resources>
 | 
				
			||||||
 | 
				
			|||||||
@ -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 + "Plugin Startet");
 | 
				
			||||||
		this.getLogger().info(prefix + ChatColor.WHITE + "Initializing Gamemanager");
 | 
							this.getLogger().info(prefix + ChatColor.WHITE + "Initializing Gamemanager");
 | 
				
			||||||
		gameManager = new GameManager(this);
 | 
							gameManager = new GameManager(this);
 | 
				
			||||||
 | 
							this.saveDefaultConfig();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Registers Events
 | 
							// Registers Events
 | 
				
			||||||
		this.getLogger().info(prefix + ChatColor.WHITE + "Lade Events");
 | 
							this.getLogger().info(prefix + ChatColor.WHITE + "Lade Events");
 | 
				
			||||||
 | 
				
			|||||||
@ -17,8 +17,14 @@ public class back implements CommandExecutor {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
 | 
					    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());
 | 
					        Player player = (Player) commandSender.getServer().getPlayer(commandSender.getName());
 | 
				
			||||||
        Location lastDeath;
 | 
					        Location lastDeath;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            lastDeath = this.gameManager.getPlugin().getPlayerDataConfig().getLocation(player.getUniqueId() + ".death");
 | 
					            lastDeath = this.gameManager.getPlugin().getPlayerDataConfig().getLocation(player.getUniqueId() + ".death");
 | 
				
			||||||
            player.teleport(lastDeath);
 | 
					            player.teleport(lastDeath);
 | 
				
			||||||
@ -27,6 +33,7 @@ public class back implements CommandExecutor {
 | 
				
			|||||||
        } catch (Exception ex) {
 | 
					        } catch (Exception ex) {
 | 
				
			||||||
            commandSender.sendMessage("Tot nicht gefunden!");
 | 
					            commandSender.sendMessage("Tot nicht gefunden!");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -36,9 +36,12 @@ public class replanting {
 | 
				
			|||||||
                target.getLocation().getWorld().dropItem(loc, new ItemStack(item[0]));
 | 
					                target.getLocation().getWorld().dropItem(loc, new ItemStack(item[0]));
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (amount.length > 1) {
 | 
				
			||||||
                for (int i = 0; i < amount[1]; i++) {
 | 
					                for (int i = 0; i < amount[1]; i++) {
 | 
				
			||||||
                    target.getLocation().getWorld().dropItem(loc, new ItemStack(item[1]));
 | 
					                    target.getLocation().getWorld().dropItem(loc, new ItemStack(item[1]));
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            crop.setAge(0);
 | 
					            crop.setAge(0);
 | 
				
			||||||
            target.setBlockData(crop);
 | 
					            target.setBlockData(crop);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,5 @@
 | 
				
			|||||||
package de.steev.bm.Listener;
 | 
					package de.steev.bm.Listener;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import de.steev.bm.BetterMinecraft;
 | 
					 | 
				
			||||||
import de.steev.bm.Manager.GameManager;
 | 
					import de.steev.bm.Manager.GameManager;
 | 
				
			||||||
import org.bukkit.Bukkit;
 | 
					import org.bukkit.Bukkit;
 | 
				
			||||||
import org.bukkit.World;
 | 
					import org.bukkit.World;
 | 
				
			||||||
@ -21,7 +20,7 @@ public class BedListener implements Listener {
 | 
				
			|||||||
    @EventHandler // Adding to the Player Variable
 | 
					    @EventHandler // Adding to the Player Variable
 | 
				
			||||||
    public void onPlayerBedEnter(PlayerBedEnterEvent event) {
 | 
					    public void onPlayerBedEnter(PlayerBedEnterEvent event) {
 | 
				
			||||||
        final World world = event.getPlayer().getWorld();
 | 
					        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++;
 | 
					            this.gameManager.getPlugin().playerInBed++;
 | 
				
			||||||
            // Checks if enough Players (currentSleeping >= OnlinePlayerAmount/2) are Sleeping
 | 
					            // Checks if enough Players (currentSleeping >= OnlinePlayerAmount/2) are Sleeping
 | 
				
			||||||
            if(this.gameManager.getPlugin().playerInBed >= (int)this.gameManager.getPlugin().getServer().getOnlinePlayers().size()/2) {
 | 
					            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;
 | 
					            this.gameManager.getPlugin().playerInBed = 0;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -21,7 +21,7 @@ public class InteractListener implements Listener {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    @EventHandler
 | 
					    @EventHandler
 | 
				
			||||||
    public void onPlayerInteract(PlayerInteractEvent event){
 | 
					    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 */
 | 
					            /** the clicked block */
 | 
				
			||||||
            Block target = event.getClickedBlock();
 | 
					            Block target = event.getClickedBlock();
 | 
				
			||||||
 | 
				
			|||||||
@ -29,12 +29,12 @@ public class KillListener implements Listener {
 | 
				
			|||||||
        int[] amounts;
 | 
					        int[] amounts;
 | 
				
			||||||
        Material[] drops;
 | 
					        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();
 | 
					            Location death = ((Player) event.getEntity()).getPlayer().getLocation();
 | 
				
			||||||
            UUID uuid = ((Player) event.getEntity()).getPlayer().getUniqueId();
 | 
					            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) {
 | 
					        } 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 };
 | 
					                amounts = new int[]{ 2,2 };
 | 
				
			||||||
                drops = new Material[]{Material.LEATHER, Material.PORKCHOP};
 | 
					                drops = new Material[]{Material.LEATHER, Material.PORKCHOP};
 | 
				
			||||||
                Death.onAnimalDeath(amounts, drops, this.gameManager.getPlugin(), event);
 | 
					                Death.onAnimalDeath(amounts, drops, this.gameManager.getPlugin(), event);
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										14
									
								
								src/main/java/de/steev/bm/Manager/ConfigManager.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								src/main/java/de/steev/bm/Manager/ConfigManager.java
									
									
									
									
									
										Normal 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);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -12,6 +12,7 @@ public class GameManager {
 | 
				
			|||||||
    private BetterMinecraft plugin;
 | 
					    private BetterMinecraft plugin;
 | 
				
			||||||
    private RecipyManager recipyManager;
 | 
					    private RecipyManager recipyManager;
 | 
				
			||||||
    private PlayerManager playerManager;
 | 
					    private PlayerManager playerManager;
 | 
				
			||||||
 | 
					    private ConfigManager configManager;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * initilizes the Gamemanager and all systems beneath it
 | 
					     * initilizes the Gamemanager and all systems beneath it
 | 
				
			||||||
@ -26,7 +27,9 @@ public class GameManager {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        this.recipyManager = new RecipyManager(this);
 | 
					        this.recipyManager = new RecipyManager(this);
 | 
				
			||||||
        this.playerManager = new PlayerManager(this);
 | 
					        this.playerManager = new PlayerManager(this);
 | 
				
			||||||
 | 
					        this.configManager = new ConfigManager(this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (this.configManager.GetBool("custom_recipes")) {
 | 
				
			||||||
            this.plugin.getLogger().info("registring Recipies");
 | 
					            this.plugin.getLogger().info("registring Recipies");
 | 
				
			||||||
            this.plugin.getLogger().info("saddle");
 | 
					            this.plugin.getLogger().info("saddle");
 | 
				
			||||||
            char[] s_ing = {'L', 'S', 'I', 'W'};
 | 
					            char[] s_ing = {'L', 'S', 'I', 'W'};
 | 
				
			||||||
@ -39,7 +42,7 @@ public class GameManager {
 | 
				
			|||||||
            String[] w_rec = {" W ", "WFW", " W "};
 | 
					            String[] w_rec = {" W ", "WFW", " W "};
 | 
				
			||||||
            Material[] w_mat = {Material.WHITE_WOOL, Material.FLINT};
 | 
					            Material[] w_mat = {Material.WHITE_WOOL, Material.FLINT};
 | 
				
			||||||
            this.recipyManager.RegisterNew(w_ing, w_mat, w_rec, 4, Material.STRING, "String");
 | 
					            this.recipyManager.RegisterNew(w_ing, w_mat, w_rec, 4, Material.STRING, "String");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public BetterMinecraft getPlugin(){
 | 
					    public BetterMinecraft getPlugin(){
 | 
				
			||||||
@ -53,5 +56,9 @@ public class GameManager {
 | 
				
			|||||||
    public PlayerManager getPlayerManager() {
 | 
					    public PlayerManager getPlayerManager() {
 | 
				
			||||||
        return playerManager;
 | 
					        return playerManager;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public ConfigManager getConfigManager() {
 | 
				
			||||||
 | 
					        return configManager;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										5
									
								
								src/main/resources/config.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								src/main/resources/config.yml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,5 @@
 | 
				
			|||||||
 | 
					improved_bed: true
 | 
				
			||||||
 | 
					custom_drops: true
 | 
				
			||||||
 | 
					custom_recipes: true
 | 
				
			||||||
 | 
					replanting: true
 | 
				
			||||||
 | 
					back_command: true
 | 
				
			||||||
		Reference in New Issue
	
	Block a user