Skip to content

Commit

Permalink
Cherry pick relevant changes from current (1.16.1) branch
Browse files Browse the repository at this point in the history
  • Loading branch information
eccentricdevotion committed Jul 1, 2020
1 parent aef2539 commit c7d6e59
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ boolean setConfigBool(CommandSender sender, String[] args, String section) {
TARDISMessage.message(sender, ChatColor.RED + "Abandoned TARDISes cannot be enabled as TARDISes are not stored in a TIPS world!");
return true;
}
plugin.getConfig().set(section, Boolean.valueOf(tf));
plugin.getConfig().set("abandon.enabled", Boolean.valueOf(tf));
} else if (first.equals("archive")) {
plugin.getConfig().set("archive.enabled", Boolean.valueOf(tf));
} else {
plugin.getConfig().set(first, Boolean.valueOf(tf));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;

import java.util.ArrayList;
import java.util.List;

/**
* Oh, yes. Harmless is just the word. That's why I like it! Doesn't kill, doesn't wound, doesn't maim. But I'll tell
* you what it does do. It is very good at opening doors!
Expand All @@ -48,7 +51,7 @@ public void onPrefsMenuClick(InventoryClickEvent event) {
InventoryView view = event.getView();
String name = view.getTitle();
if (name.equals(ChatColor.DARK_RED + "TARDIS Key Prefs Menu")) {
Player p = (Player) event.getWhoClicked();
Player player = (Player) event.getWhoClicked();
int slot = event.getRawSlot();
if (slot >= 0 && slot < 27) {
switch (slot) {
Expand All @@ -73,19 +76,34 @@ public void onPrefsMenuClick(InventoryClickEvent event) {
}
// get Display name of selected key
ItemStack choice = view.getItem(slot);
ItemMeta choice_im = choice.getItemMeta();
String choice_name = choice_im.getDisplayName();
ItemMeta sonic_im = key.getItemMeta();
sonic_im.setDisplayName(choice_name);
sonic_im.setCustomModelData(choice_im.getCustomModelData());
key.setItemMeta(sonic_im);
ItemMeta choiceMeta = choice.getItemMeta();
String displayName = choiceMeta.getDisplayName();
ItemMeta keyMeta = key.getItemMeta();
keyMeta.setDisplayName(displayName);
keyMeta.setCustomModelData(choiceMeta.getCustomModelData());
// personalise
keyMeta.getPersistentDataContainer().set(TARDIS.plugin.getTimeLordUuidKey(), TARDIS.plugin.getPersistentDataTypeUUID(), player.getUniqueId());
// set lore
List<String> lore;
if (keyMeta.hasLore()) {
lore = keyMeta.getLore();
} else {
lore = new ArrayList<>();
}
String format = ChatColor.AQUA + "" + ChatColor.ITALIC;
if (!lore.contains(format + "This key belongs to")) {
lore.add(format + "This key belongs to");
lore.add(format + player.getName());
keyMeta.setLore(lore);
}
key.setItemMeta(keyMeta);
break;
case 18:
break;
case 26:
// close
event.setCancelled(true);
close(p);
close(player);
break;
default:
event.setCancelled(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.bukkit.Location;
import org.bukkit.entity.Player;

import java.util.Collections;
import java.util.HashMap;
import java.util.Locale;

Expand Down Expand Up @@ -66,9 +65,9 @@ public boolean toggle(Player player, int id, String[] args, boolean admin) {
TARDISHandbrake.setLevers(location.getBlock(), true, true, location.toString(), id, plugin);
if (bool) {
plugin.getTrackerKeeper().getDestinationVortex().remove(id);
plugin.getTrackerKeeper().getInVortex().removeAll(Collections.singletonList(id));
plugin.getTrackerKeeper().getMaterialising().removeAll(Collections.singletonList(id));
plugin.getTrackerKeeper().getDidDematToVortex().removeAll(Collections.singletonList(id));
plugin.getTrackerKeeper().getInVortex().remove(id);
plugin.getTrackerKeeper().getMaterialising().remove(id);
plugin.getTrackerKeeper().getDidDematToVortex().remove(id);
}
if (!admin) {
TARDISMessage.send(player, "HANDBRAKE_ON_OFF", args[1].toUpperCase(Locale.ENGLISH));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
Expand Down Expand Up @@ -150,10 +149,10 @@ public void load() {
new TARDISInstantPreset(plugin, bd, rs.getTardis().getPreset(), Material.LIGHT_GRAY_TERRACOTTA.createBlockData(), false).buildPreset();
}
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> {
plugin.getTrackerKeeper().getInVortex().removeAll(Collections.singletonList(id));
plugin.getTrackerKeeper().getDidDematToVortex().removeAll(Collections.singletonList(id));
plugin.getTrackerKeeper().getInVortex().remove(id);
plugin.getTrackerKeeper().getDidDematToVortex().remove(id);
plugin.getTrackerKeeper().getDestinationVortex().remove(id);
plugin.getTrackerKeeper().getDematerialising().removeAll(Collections.singletonList(id));
plugin.getTrackerKeeper().getDematerialising().remove(id);
}, 20L);
}
land++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,12 @@ public void onPerceptionFilterClick(PlayerInteractEvent event) {
if (chestplate == null) {
// equip the chest slot with the perception filter
player.getInventory().setChestplate(is);
player.getInventory().setItemInMainHand(new ItemStack(Material.AIR));
player.updateInventory();
// make the player invisible
plugin.getFilter().addPerceptionFilter(player);
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> {
player.getInventory().setItemInMainHand(new ItemStack(Material.AIR));
player.updateInventory();
// make the player invisible
plugin.getFilter().addPerceptionFilter(player);
}, 1L);
} else {
TARDISMessage.send(player, "FILTER");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,9 @@ public void onInteract(PlayerInteractEvent event) {
return;
}
if (TARDISPermission.hasPermission(player, "tardis.sonic.arrow") && lore != null && lore.contains("Pickup Arrows Upgrade")) {
TARDISSonicSound.playSonicSound(plugin, player, now, 600L, "sonic_short");
// scan area around block for an arrow
if (!block.getType().isInteractable()) {
TARDISSonicSound.playSonicSound(plugin, player, now, 600L, "sonic_short");
} // scan area around block for an arrow
List<Entity> nearbyEntites = new ArrayList(block.getWorld().getNearbyEntities(block.getLocation(), 2, 2, 2));
for (Entity e : nearbyEntites) {
if (e instanceof Arrow) {
Expand Down

0 comments on commit c7d6e59

Please sign in to comment.