Skip to content

Commit

Permalink
Merge pull request #78 from RedstoneFuture/refactoring/remove-old-ver…
Browse files Browse the repository at this point in the history
…sion-support

Remove old version support (<1.13)
  • Loading branch information
daniel-naegele authored Apr 18, 2023
2 parents 80cd1be + a2ea829 commit 17fcf25
Show file tree
Hide file tree
Showing 27 changed files with 139 additions and 640 deletions.
42 changes: 0 additions & 42 deletions 1_12/pom.xml

This file was deleted.

This file was deleted.

This file was deleted.

6 changes: 0 additions & 6 deletions missilewars-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,6 @@
</repositories>

<dependencies>
<dependency>
<groupId>de.butzlabben</groupId>
<artifactId>1_12</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>de.butzlabben</groupId>
<artifactId>1_13</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,9 @@ private void sendPluginInfo() {

Logger.BOOT.log("This server is running MissileWars v" + version + " by Butzlabben");

if (VersionUtil.getVersion() < 8) {
if (VersionUtil.getVersion() < 13) {
Logger.WARN.log("====================================================");
Logger.WARN.log("It seems that you are using version older than 1.8");
Logger.WARN.log("It seems that you are using version older than 1.13");
Logger.WARN.log("There is no guarantee for this to work");
Logger.WARN.log("Proceed with extreme caution");
Logger.WARN.log("====================================================");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import de.butzlabben.missilewars.util.stats.PlayerGuiFactory;
import de.butzlabben.missilewars.util.stats.PreFetcher;
import de.butzlabben.missilewars.util.stats.StatsUtil;
import de.butzlabben.missilewars.util.version.VersionUtil;
import org.bukkit.Material;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
Expand Down Expand Up @@ -83,7 +82,7 @@ public void onStats(CommandSender sender, String[] args) {
inv.addItem(9, new OrcItem(Material.SLIME_BLOCK, "§aGeneral statistics", generalLore));

List<String> playerLore = Arrays.asList("§7Unique players: §e" + fetcher.getUniquePlayers(), "", "§7Click to list players");
OrcItem players = new OrcItem(VersionUtil.getPlayerSkullMaterial(), "§aPlayers", playerLore);
OrcItem players = new OrcItem(Material.PLAYER_HEAD, "§aPlayers", playerLore);
players.setOnClick((p, inventory, item) -> {
p.closeInventory();
preFetchRunnable.stop();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,9 @@
import de.butzlabben.missilewars.util.geometry.GameArea;
import de.butzlabben.missilewars.util.geometry.Geometry;
import de.butzlabben.missilewars.util.serialization.Serializer;
import de.butzlabben.missilewars.util.version.VersionUtil;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.function.Consumer;
import lombok.Getter;
import lombok.ToString;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.*;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Fireball;
import org.bukkit.entity.Player;
Expand All @@ -76,6 +66,12 @@
import org.bukkit.scoreboard.Scoreboard;
import org.bukkit.util.Vector;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.function.Consumer;

/**
* @author Butzlabben
* @since 01.01.2018
Expand Down Expand Up @@ -350,8 +346,8 @@ public void playerJoinInGame(Player player, boolean isSpectatorJoin) {

// team change menu:
if (player.hasPermission("mw.change")) {
player.getInventory().setItem(0, VersionUtil.getGlassPlane(team1));
player.getInventory().setItem(8, VersionUtil.getGlassPlane(team2));
player.getInventory().setItem(0, team1.getGlassPlane());
player.getInventory().setItem(8, team2.getGlassPlane());
}

// map choose menu:
Expand Down Expand Up @@ -544,18 +540,20 @@ private void createGameItems() {
bow.addEnchantment(Enchantment.ARROW_FIRE, 1);
bow.addEnchantment(Enchantment.ARROW_DAMAGE, 1);
bow.addEnchantment(Enchantment.ARROW_KNOCKBACK, 1);
ItemMeta im = bow.getItemMeta();
im.addEnchant(Enchantment.DAMAGE_ALL, 6, true);
bow.setItemMeta(im);
VersionUtil.setUnbreakable(bow);
ItemMeta bowMeta = bow.getItemMeta();
bowMeta.setUnbreakable(true);
bowMeta.addEnchant(Enchantment.DAMAGE_ALL, 6, true);
bow.setItemMeta(bowMeta);
this.customBow = bow;
}

// Will it be used ?
if (this.getArena().getSpawn().isSendPickaxe() || this.getArena().getRespawn().isSendPickaxe()) {

ItemStack pickaxe = new ItemStack(Material.IRON_PICKAXE);
VersionUtil.setUnbreakable(pickaxe);
ItemMeta pickaxeMeta = pickaxe.getItemMeta();
pickaxeMeta.setUnbreakable(true);
pickaxe.setItemMeta(pickaxeMeta);
this.customPickaxe = pickaxe;
}

Expand Down Expand Up @@ -585,26 +583,15 @@ public void sendGameItems(Player player, boolean isRespawn) {
// send kit items
if (isRespawn) {

if (this.getArena().getRespawn().isSendBow()) {
player.getInventory().addItem(this.customBow);
}

if (this.getArena().getRespawn().isSendPickaxe()) {
player.getInventory().addItem(this.customPickaxe);
}
if (this.getArena().getRespawn().isSendBow()) player.getInventory().addItem(this.customBow);
if (this.getArena().getRespawn().isSendPickaxe()) player.getInventory().addItem(this.customPickaxe);

} else {

if (this.getArena().getSpawn().isSendBow()) {
player.getInventory().addItem(this.customBow);
}

if (this.getArena().getSpawn().isSendPickaxe()) {
player.getInventory().addItem(this.customPickaxe);
}

if (this.getArena().getSpawn().isSendBow()) player.getInventory().addItem(this.customBow);
if (this.getArena().getSpawn().isSendPickaxe()) player.getInventory().addItem(this.customPickaxe);

}

}

/**
Expand Down Expand Up @@ -663,14 +650,11 @@ public void spawnMissile(Player player, ItemStack itemStack) {
public void spawnFireball(Player player, ItemStack itemStack) {
int amount = itemStack.getAmount();
itemStack.setAmount(amount - 1);

if (amount == 1 && VersionUtil.getVersion() == 8) {
player.getInventory().remove(VersionUtil.getFireball());
}


Fireball fb = player.launchProjectile(Fireball.class);
fb.setVelocity(player.getLocation().getDirection().multiply(2.5D));
VersionUtil.playFireball(player, fb.getLocation());
player.playSound(fb.getLocation(), Sound.BLOCK_ANVIL_LAND, 100.0F, 2.0F);
player.playSound(fb.getLocation(), Sound.ITEM_FLINTANDSTEEL_USE, 100.0F, 1.0F);
fb.setYield(3F);
fb.setIsIncendiary(true);
fb.setBounce(false);
Expand Down Expand Up @@ -810,8 +794,8 @@ public void sendNeutralGameResultTitle(Player player) {
subTitle = Messages.getNativeMessage("game_result.subtitle_draw");

}

VersionUtil.sendTitle(player, title, subTitle);
player.sendTitle(title, subTitle);
}

/**
Expand Down
Loading

0 comments on commit 17fcf25

Please sign in to comment.