Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @SuppressWarnings("deprecation")
- public void checkRegion(Region r, String s, Team t, Player player) {
- if(shouldDamage(r, player) && budovy.get(s) > 0) {
- int playercount = 0;
- if(t == blueTeam) {
- playercount = getRedCount(r) - getBlueCount(r);
- } else {
- playercount = getBlueCount(r) - getRedCount(r);
- }
- int ticks = 20;
- if(playercount > 4) {
- playercount = 4;
- }
- playercount = 1;
- if(playercount == 1) {
- ticks = 50;
- } else if(playercount == 2) {
- ticks = 30;
- } else if(playercount == 3) {
- ticks = 20;
- } else if(playercount == 4) {
- ticks = 10;
- }
- Location p1 = r.getMinimalLocation();
- Location p2 = r.getMaximalLocation();
- if(p1.getY() > p2.getY()) {
- p2.setY(p1.getY() + 2);
- } else {
- p1.setY(p2.getY() + 2);
- }
- Location result = p1.add(p1.subtract(p2).multiply(0.5));
- if(playercount > 0) {
- Pexel.getCore().getServer().broadcastMessage("Should dmg tower! " + playercount + " / " + (System.currentTimeMillis() - budovyp.get(s)));
- budovyp.put(s, System.currentTimeMillis());
- if(budovyp.get(s) >= (System.currentTimeMillis() + ticks * 50)) {
- Pexel.getCore().getServer().broadcastMessage("Capturing tower!");
- player.sendMessage("You are capturing tower of enemy team!");
- for(Player pl : t.getPlayers()) {
- pl.playSound(player.getLocation(), Sound.NOTE_PLING, 1.0f, 1.0f);
- pl.sendMessage("Your tower is being captured! " + budovy.get(s));
- }
- /*
- * Firework fw = (Firework)
- * player.getWorld().spawnEntity(result,
- * EntityType.FIREWORK); FireworkMeta fwm =
- * fw.getFireworkMeta(); FireworkEffect effect =
- * FireworkEffect
- * .builder().withColor(Color.BLUE).with(Type.BALL).build();
- * fwm.addEffect(effect); fwm.setPower(2);
- * fw.setFireworkMeta(fwm);
- */
- budovy.put(s, budovy.get(s) - 1);
- } else if(budovyp.get(s).toString() == "") {
- budovyp.put(s, System.currentTimeMillis());
- }
- }
- } else if(budovy.get(s) == 0) {
- if(t == redTeam) {
- doReplace(r.getMinimalLocation(), r.getMaximalLocation(), Material.WOOL, Material.WOOL, DyeColor.RED.getData(), DyeColor.BLUE.getData());
- Pexel.getCore().getServer().broadcastMessage("Changing red to blue!");
- } else {
- Pexel.getCore().getServer().broadcastMessage("Changing red to blue!");
- doReplace(r.getMinimalLocation(), r.getMaximalLocation(), Material.WOOL, Material.WOOL, DyeColor.BLUE.getData(), DyeColor.RED.getData());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment