Skip to content

Commit 5884e7b

Browse files
committed
Strip to 1.8 compatibility (DeathSpectatingLite)
No, I am not maintaining this branch, feel free to fork and maintain yourself though.
1 parent d5ff048 commit 5884e7b

File tree

6 files changed

+8
-185
lines changed

6 files changed

+8
-185
lines changed

pom.xml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
<modelVersion>4.0.0</modelVersion>
66

77
<groupId>to.us.tf</groupId>
8-
<artifactId>DeathSpectating</artifactId>
9-
<version>1.1.3</version>
8+
<artifactId>DeathSpectatingLite</artifactId>
9+
<version>1.0</version>
1010
<properties>
1111
<maven.compiler.source>1.8</maven.compiler.source>
1212
<maven.compiler.target>1.8</maven.compiler.target>
1313
</properties>
1414
<repositories>
1515
<repository>
16-
<id>paper-repo</id>
17-
<url>https://repo.destroystokyo.com/repository/maven-public/</url>
16+
<id>spigot-repo</id>
17+
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
1818
</repository>
1919
</repositories>
2020
<build>
@@ -31,9 +31,9 @@
3131
</build>
3232
<dependencies>
3333
<dependency>
34-
<groupId>com.destroystokyo.paper</groupId>
35-
<artifactId>paper-api</artifactId>
36-
<version>1.11.2-R0.1-SNAPSHOT</version>
34+
<groupId>org.bukkit</groupId>
35+
<artifactId>bukkit</artifactId>
36+
<version>1.8.8-R0.1-SNAPSHOT</version>
3737
<type>jar</type>
3838
<scope>provided</scope>
3939
</dependency>

src/main/java/to/us/tf/DeathSpectating/CompatUtil.java

Lines changed: 0 additions & 44 deletions
This file was deleted.

src/main/java/to/us/tf/DeathSpectating/ConfigManager.java

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import org.bukkit.entity.Player;
88
import org.bukkit.event.entity.EntityDamageEvent;
99

10-
import javax.annotation.Nonnull;
1110
import java.text.MessageFormat;
1211
import java.util.ArrayList;
1312
import java.util.Arrays;
@@ -98,24 +97,6 @@ public class ConfigManager
9897
if (messageSection.getString("deniedCommand") == null)
9998
messageSection.set("deniedCommand", "&cYou are not allowed to use that command while death spectating.");
10099
messages.put("deniedCommand", formatter(messageSection.getString("deniedCommand")));
101-
102-
//Title messages
103-
ConfigurationSection titleSection = config.getConfigurationSection("titleMessages");
104-
if (titleSection == null)
105-
titleSection = config.createSection("titleMessages");
106-
107-
if (titleSection.getStringList("titles").isEmpty())
108-
titleSection.set("titles", new ArrayList<>(Arrays.asList("&cYou died!", "&cGame over!")));
109-
if (titleSection.getStringList("subtitles").isEmpty())
110-
titleSection.set("subtitles", new ArrayList<>(Arrays.asList("Respawning in {0}", "Score: &e{1}", "Score: &e{1}&f, Respawning in {0}")));
111-
112-
instance.saveConfig();
113-
}
114-
115-
public String getDeathTitle(@Nonnull String titleType)
116-
{
117-
List<String> hi = config.getConfigurationSection("titleMessages").getStringList(titleType);
118-
return hi.get(ThreadLocalRandom.current().nextInt(hi.size()));
119100
}
120101

121102
public long getRespawnTicks()

src/main/java/to/us/tf/DeathSpectating/DeathSpectating.java

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
package to.us.tf.DeathSpectating;
22

3-
import org.bukkit.Effect;
43
import org.bukkit.GameMode;
54
import org.bukkit.Location;
65
import org.bukkit.Material;
7-
import org.bukkit.Particle;
86
import org.bukkit.Statistic;
9-
import org.bukkit.World;
10-
import org.bukkit.enchantments.Enchantment;
11-
import org.bukkit.entity.Creature;
127
import org.bukkit.entity.Entity;
138
import org.bukkit.entity.EntityType;
149
import org.bukkit.entity.ExperienceOrb;
@@ -24,9 +19,7 @@
2419
import org.bukkit.metadata.FixedMetadataValue;
2520
import org.bukkit.plugin.java.JavaPlugin;
2621
import org.bukkit.potion.PotionEffect;
27-
import org.bukkit.scheduler.BukkitRunnable;
2822
import to.us.tf.DeathSpectating.events.DeathSpectatingEvent;
29-
import to.us.tf.DeathSpectating.features.Titles;
3023
import to.us.tf.DeathSpectating.listeners.DamageListener;
3124
import to.us.tf.DeathSpectating.listeners.MiscListeners;
3225
import to.us.tf.DeathSpectating.tasks.SpectateTask;
@@ -49,8 +42,6 @@ public void onEnable()
4942
getServer().getPluginManager().registerEvents(this, this);
5043
getServer().getPluginManager().registerEvents(new DamageListener(this), this);
5144
getServer().getPluginManager().registerEvents(new MiscListeners(this), this);
52-
if (!CompatUtil.isOlder(11)) //TODO: register in class, not in main(?)
53-
getServer().getPluginManager().registerEvents(new Titles(this, configManager), this);
5445
}
5546

5647
public ConfigManager getConfigManager()
@@ -163,7 +154,7 @@ public boolean startDeathSpectating(Player player)
163154
//Compile a list of null-free/air-free items to drop
164155
for (ItemStack itemStack : player.getInventory().getContents())
165156
{
166-
if (itemStack != null && itemStack.getType() != Material.AIR && !itemStack.containsEnchantment(Enchantment.VANISHING_CURSE))
157+
if (itemStack != null && itemStack.getType() != Material.AIR)
167158
itemsToDrop.add(itemStack);
168159
}
169160
}
@@ -212,11 +203,6 @@ public boolean startDeathSpectating(Player player)
212203
player.incrementStatistic(Statistic.DEATHS);
213204
player.setStatistic(Statistic.TIME_SINCE_DEATH, 0);
214205

215-
//TODO: Non-vanilla behavior: Player death animation (red and falling over) (Issue #13)
216-
//Smoke effect //TODO: after 20 ticks (Issue #14) (Will implement 20 tick delay after issue #13 is resolved
217-
if (isSpectating(player)) //TODO: does smoke effect/death animation occur if player#spigot()#respawn() is called on death? My guess is no.
218-
player.getWorld().spawnParticle(Particle.CLOUD, player.getLocation(), 25);
219-
220206
//Clear potion effects
221207
for (PotionEffect potionEffect : player.getActivePotionEffects())
222208
player.removePotionEffect(potionEffect.getType());

src/main/java/to/us/tf/DeathSpectating/features/Titles.java

Lines changed: 0 additions & 84 deletions
This file was deleted.

src/main/java/to/us/tf/DeathSpectating/listeners/DamageListener.java

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
package to.us.tf.DeathSpectating.listeners;
22

3-
import org.bukkit.Material;
43
import org.bukkit.entity.EntityType;
54
import org.bukkit.entity.Player;
65
import org.bukkit.event.EventHandler;
76
import org.bukkit.event.EventPriority;
87
import org.bukkit.event.Listener;
98
import org.bukkit.event.entity.EntityDamageEvent;
10-
import org.bukkit.inventory.Inventory;
11-
import org.bukkit.inventory.PlayerInventory;
12-
import to.us.tf.DeathSpectating.CompatUtil;
139
import to.us.tf.DeathSpectating.DeathSpectating;
1410

1511
/**
@@ -40,18 +36,6 @@ void onPlayerBasicallyWouldBeDead(EntityDamageEvent event)
4036
if (player.getHealth() > event.getFinalDamage())
4137
return;
4238

43-
//Ignore if player is holding a totem of undying
44-
PlayerInventory inventory = player.getInventory();
45-
try
46-
{
47-
if (inventory.getItemInMainHand().getType() == Material.TOTEM || inventory.getItemInOffHand().getType() == Material.TOTEM)
48-
return;
49-
}
50-
catch (NoSuchFieldError | NoSuchMethodError e) //TOTEM (not in 1.10 and below) //getItemInMainHand, etc. (not in 1.8 and below)
51-
{
52-
if (CompatUtil.isNewer()) throw e;
53-
}
54-
5539
//Ignore if this is probably the result of the Essentials suicide command
5640
//Essentials will perform Player#setHealth(0), which does not fire a damage event, but does kill the player. This will lead to a double death message.
5741
if ((event.getCause() == EntityDamageEvent.DamageCause.CUSTOM || event.getCause() == EntityDamageEvent.DamageCause.SUICIDE)

0 commit comments

Comments
 (0)