Dieser Commit ist enthalten in:
Ursprung
4c68900162
Commit
95457509aa
@ -104,6 +104,11 @@ public class MWTeam {
|
||||
Inventory inventory = p.getInventory();
|
||||
for (int i = 0; i <= 35; i++) { // 35 is the last normal inventory slot
|
||||
ItemStack itemStack = inventory.getItem(i);
|
||||
if (itemStack != null && itemStack.isSimilar(item) && itemStack.getAmount() + item.getAmount() <= item.getMaxStackSize()) {
|
||||
itemStack.setAmount(itemStack.getAmount() + item.getAmount());
|
||||
inventory.setItem(i, itemStack);
|
||||
return;
|
||||
}
|
||||
if (itemStack != null && itemStack.getType() == item.getType() && getUsesOfItem(itemStack) + getUsesOfItem(item) <= itemStack.getType().getMaxDurability()) {
|
||||
int uses = getUsesOfItem(itemStack) + getUsesOfItem(item);
|
||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||
@ -112,10 +117,6 @@ public class MWTeam {
|
||||
itemStack.setItemMeta(damageable);
|
||||
inventory.setItem(i, itemStack);
|
||||
return;
|
||||
} else if (itemStack != null && itemStack.isSimilar(item) && itemStack.getAmount() + item.getAmount() <= item.getMaxStackSize()) {
|
||||
itemStack.setAmount(itemStack.getAmount() + item.getAmount());
|
||||
inventory.setItem(i, itemStack);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,11 +41,6 @@ public class ItemCountdown extends StateDependent {
|
||||
}
|
||||
|
||||
private void run() {
|
||||
if (currenTime == 0) {
|
||||
ItemStack itemStack = SpecialItem.getRandomItem();
|
||||
MissileWars.getBlueTeam().givePlayerItem(itemStack);
|
||||
MissileWars.getRedTeam().givePlayerItem(itemStack);
|
||||
}
|
||||
currenTime++;
|
||||
|
||||
int teamCount = Math.max(MissileWars.getBlueTeam().size(), MissileWars.getRedTeam().size());
|
||||
|
@ -40,7 +40,8 @@ import java.util.Random;
|
||||
public abstract class SpecialItem {
|
||||
|
||||
private static final Random random = new Random();
|
||||
private static long count = 0;
|
||||
private static double count = 0;
|
||||
private static int consecutiveSupportItems = 0;
|
||||
|
||||
private static List<SpecialItem> supportItems = new ArrayList<>();
|
||||
private static List<SpecialItem> missileItems = new ArrayList<>();
|
||||
@ -110,14 +111,21 @@ public abstract class SpecialItem {
|
||||
}
|
||||
|
||||
public static ItemStack getRandomItem() {
|
||||
if (Config.MissileChance == 0 || consecutiveSupportItems > 1) {
|
||||
consecutiveSupportItems = 0;
|
||||
return supportItems.get(random.nextInt(supportItems.size())).getItem();
|
||||
}
|
||||
if (Config.MissileChance == 1) {
|
||||
return missileItems.get(random.nextInt(missileItems.size())).getItem();
|
||||
}
|
||||
|
||||
double missileChance = Config.MissileChance + count * 0.1;
|
||||
if (Config.MissileChance == 0) missileChance = 0.0;
|
||||
if (Config.MissileChance == 1) missileChance = 1.0;
|
||||
if (random.nextDouble() > missileChance) {
|
||||
count++;
|
||||
count += Config.MissileChance;
|
||||
consecutiveSupportItems++;
|
||||
return supportItems.get(random.nextInt(supportItems.size())).getItem();
|
||||
} else {
|
||||
count--;
|
||||
count -= 1 - Config.MissileChance;
|
||||
return missileItems.get(random.nextInt(missileItems.size())).getItem();
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren