Войти или зарегистрироваться

Помогите BedWars функция спавна предметов.

Статус
Закрыто для дальнейших ответов.

mc_archeage

Новичок
Пользователь
Баллы
11
Имя в Minecraft
NegaTiV
1)Нужна та часть кода BedWars что отвечает за спавн дропа в определенной локацией, + интервалом.Помогите пожалуста.
2)Ребят пример кода таймера для повтора части кода раз в 10 секунд.
3)Как напремер в конфиге есть секции
Loc:
one:
Item: Stone
Interval: 10
x: 1
y: 2
z: 3
two: Grees
Interval: 20
x:1
y:2
z:3
Чтоб в части евента конфиг брал для работы секцию one,и two...одновременно но они не препЯтствуали работе друг друга.Чтоб неписат ещо раз тот самий евент и для него 2.Так как в конфиге можеть бить многа секций.Прошу помощи.
 
Последнее редактирование:
певной = определенной
пожалуста = пожалуйста
одновремена = одновременно
неперескоджали = не препятствовали
работи = роботе
неписат = не писать
ьищораз = еще раз
тот самий = этот-же
нево = него
бить = быть
помоши = помощи
 
певной = определенной
пожалуста = пожалуйста
одновремена = одновременно
неперескоджали = не
препятствовали
работи = роботе
неписат = не писать
ьищораз = еще раз
тот самий = этот-же
нево = него
бить = быть
помоши = помощи
Спасибо.
UP
 
BedWars Reloaded имеет открытый исходный код и автор никак не запрещает его модифицировать. Собственно, в чём ваша проблема?
Наверная я тупой.Но я немогу найти код которий нада мнє.
 
Вот нашол но разобратса толково немогу в интервале.
@Override public void run() { Location dropLocation = this.location; Item item = this.game.getRegion().getWorld() .dropItemNaturally(dropLocation, this.itemstack); item.setPickupDelay(0); if(this.spread != 1.0) { item.setVelocity(item.getVelocity().multiply(this.spread));
Ну понятна локация ета место дропа.Етат итемстак предмет.
но вот интервал где вказать
public RessourceSpawner(Map<String, Object> deserialize) { this.location = Utils.locationDeserialize(deserialize.get("location")); if(deserialize.containsKey("name")) { this.name = deserialize.get("name").toString(); if(!Main.getInstance().getConfig().contains("ressource." + this.name)) { this.itemstack = (ItemStack) deserialize.get("itemstack"); this.interval = Integer.parseInt(deserialize.get("interval").toString()); if(deserialize.containsKey("spread")) { this.spread = Double.parseDouble(deserialize.get("spread").toString()); } } else { this.itemstack = RessourceSpawner.createSpawnerStackByConfig(Main.getInstance().getConfig().get("ressource." + this.name)); this.interval = Main.getInstance().getIntConfig("ressource." + this.name + ".spawn-interval", 1000); this.spread = Main.getInstance().getConfig().getDouble("ressource." + this.name + ".spread", 1.0); } } else { ItemStack stack = (ItemStack) deserialize.get("itemstack"); this.name = this.getNameByMaterial(stack.getType()); if(this.name == null) { this.itemstack = stack; this.interval = Integer.parseInt(deserialize.get("interval").toString()); if(deserialize.containsKey("spread")) { this.spread = Double.parseDouble(deserialize.get("spread").toString()); } } else { this.itemstack = RessourceSpawner.createSpawnerStackByConfig(Main.getInstance().getConfig().get("ressource." + this.name)); this.interval = Main.getInstance().getIntConfig("ressource." + this.name + ".spawn-interval", 1000); this.spread = Main.getInstance().getConfig().getDouble("ressource." + this.name + ".spread", 1.0); } } } public RessourceSpawner(Game game, String name, Location location) { this.game = game; this.name = name; this.interval = Main.getInstance().getIntConfig("ressource." + this.name + ".spawn-interval", 1000); this.location = location; this.itemstack = RessourceSpawner.createSpawnerStackByConfig(Main.getInstance().getConfig().get("ressource." + this.name));; this.spread = Main.getInstance().getConfig().getDouble("ressource." + this.name + ".spread", 1.0); } private String getNameByMaterial(Material material) { for(String key : Main.getInstance().getConfig().getConfigurationSection("ressource").getKeys(true)) { ConfigurationSection keySection = Main.getInstance().getConfig().getConfigurationSection("ressource." + key); if(keySection == null) { continue; } if(!keySection.contains("item")) { continue; } Material mat = Utils.parseMaterial(keySection.getString("item")); if(mat.equals(material)) { return key; } } return null;
 
Вот нашол но разобратса толково немогу в интервале.
@Override public void run() { Location dropLocation = this.location; Item item = this.game.getRegion().getWorld() .dropItemNaturally(dropLocation, this.itemstack); item.setPickupDelay(0); if(this.spread != 1.0) { item.setVelocity(item.getVelocity().multiply(this.spread));
Ну понятна локация ета место дропа.Етат итемстак предмет.
но вот интервал где вказать
public RessourceSpawner(Map<String, Object> deserialize) { this.location = Utils.locationDeserialize(deserialize.get("location")); if(deserialize.containsKey("name")) { this.name = deserialize.get("name").toString(); if(!Main.getInstance().getConfig().contains("ressource." + this.name)) { this.itemstack = (ItemStack) deserialize.get("itemstack"); this.interval = Integer.parseInt(deserialize.get("interval").toString()); if(deserialize.containsKey("spread")) { this.spread = Double.parseDouble(deserialize.get("spread").toString()); } } else { this.itemstack = RessourceSpawner.createSpawnerStackByConfig(Main.getInstance().getConfig().get("ressource." + this.name)); this.interval = Main.getInstance().getIntConfig("ressource." + this.name + ".spawn-interval", 1000); this.spread = Main.getInstance().getConfig().getDouble("ressource." + this.name + ".spread", 1.0); } } else { ItemStack stack = (ItemStack) deserialize.get("itemstack"); this.name = this.getNameByMaterial(stack.getType()); if(this.name == null) { this.itemstack = stack; this.interval = Integer.parseInt(deserialize.get("interval").toString()); if(deserialize.containsKey("spread")) { this.spread = Double.parseDouble(deserialize.get("spread").toString()); } } else { this.itemstack = RessourceSpawner.createSpawnerStackByConfig(Main.getInstance().getConfig().get("ressource." + this.name)); this.interval = Main.getInstance().getIntConfig("ressource." + this.name + ".spawn-interval", 1000); this.spread = Main.getInstance().getConfig().getDouble("ressource." + this.name + ".spread", 1.0); } } } public RessourceSpawner(Game game, String name, Location location) { this.game = game; this.name = name; this.interval = Main.getInstance().getIntConfig("ressource." + this.name + ".spawn-interval", 1000); this.location = location; this.itemstack = RessourceSpawner.createSpawnerStackByConfig(Main.getInstance().getConfig().get("ressource." + this.name));; this.spread = Main.getInstance().getConfig().getDouble("ressource." + this.name + ".spread", 1.0); } private String getNameByMaterial(Material material) { for(String key : Main.getInstance().getConfig().getConfigurationSection("ressource").getKeys(true)) { ConfigurationSection keySection = Main.getInstance().getConfig().getConfigurationSection("ressource." + key); if(keySection == null) { continue; } if(!keySection.contains("item")) { continue; } Material mat = Utils.parseMaterial(keySection.getString("item")); if(mat.equals(material)) { return key; } } return null;
Там всё подробно расписано, еще и комментарии везде. Я ж помню, я с ним возился. Ищи хорошенько.
 
Статус
Закрыто для дальнейших ответов.
Назад
Верх