SteamWar/MissileWars
Archiviert
13
0

Fix Bows in Chest

Dieser Commit ist enthalten in:
Chaoscaot 2020-08-30 21:37:10 +02:00
Ursprung 7f2c1b0522
Commit 3645657683
2 geänderte Dateien mit 15 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -97,4 +97,8 @@ public class MWTeam {
public String getColoredName() { public String getColoredName() {
return color.toString() + teamName; return color.toString() + teamName;
} }
public static ItemStack getBow() {
return bow;
}
} }

Datei anzeigen

@ -11,14 +11,17 @@ import com.sk89q.worldedit.session.ClipboardHolder;
import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.World;
import de.steamwar.misslewars.Config; import de.steamwar.misslewars.Config;
import de.steamwar.misslewars.FightState; import de.steamwar.misslewars.FightState;
import de.steamwar.misslewars.MWTeam;
import de.steamwar.misslewars.MissileWars; import de.steamwar.misslewars.MissileWars;
import de.steamwar.misslewars.items.SpecialItem; import de.steamwar.misslewars.items.SpecialItem;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Snowball; import org.bukkit.entity.Snowball;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action; import org.bukkit.event.block.Action;
import org.bukkit.event.entity.ProjectileLaunchEvent; import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -78,4 +81,12 @@ public class ItemListener extends BasicListener {
}, Config.ShieldFlyTime); }, Config.ShieldFlyTime);
} }
} }
@EventHandler(ignoreCancelled = true)
public void onInventoryClose(InventoryCloseEvent event) {
if(event.getInventory().contains(MWTeam.getBow())) {
event.getInventory().setItem(event.getInventory().first(MWTeam.getBow()), new ItemStack(Material.AIR));
event.getPlayer().getInventory().addItem(MWTeam.getBow());
}
}
} }