-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Добавлена возможность призывать Некоглая - Добавление заготовок для обновления системы исполнения команд для более четкой структурированности (для конечного пользователя заметно не будет)
- Loading branch information
Showing
13 changed files
with
225 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/main/java/igorlink/donationexecutor/executionsstaff/executionsmanagement/Executor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package igorlink.donationexecutor.executionsstaff.executionsmanagement; | ||
|
||
import igorlink.donationexecutor.executionsstaff.executionsmanagement.executions.AbstractExecution; | ||
import igorlink.donationexecutor.executionsstaff.executionsmanagement.executions.inventory.ShitToInventory; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class Executor { | ||
private static List<AbstractExecution> listOfExecutions = new ArrayList<AbstractExecution>(); | ||
|
||
public Executor() { | ||
new ShitToInventory(); | ||
} | ||
|
||
public static void AddToList(AbstractExecution execution) { | ||
listOfExecutions.add(execution); | ||
} | ||
|
||
|
||
|
||
|
||
} |
23 changes: 23 additions & 0 deletions
23
...k/donationexecutor/executionsstaff/executionsmanagement/executions/AbstractExecution.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package igorlink.donationexecutor.executionsstaff.executionsmanagement.executions; | ||
|
||
import igorlink.donationexecutor.executionsstaff.executionsmanagement.Executor; | ||
import org.bukkit.entity.Player; | ||
|
||
public abstract class AbstractExecution { | ||
private String execName; | ||
|
||
public AbstractExecution() { | ||
String className = this.getClass().getName(); | ||
String packageName = this.getClass().getPackageName() + "."; | ||
className = className.replace(packageName, ""); | ||
execName = className; | ||
Executor.AddToList(this); | ||
} | ||
|
||
public abstract Boolean execute(String donationUsername, Player player); | ||
|
||
public String getName() { | ||
return execName; | ||
} | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
...ionexecutor/executionsstaff/executionsmanagement/executions/inventory/DropActiveItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package igorlink.donationexecutor.executionsstaff.executionsmanagement.executions.inventory; | ||
|
||
import igorlink.donationexecutor.executionsstaff.executionsmanagement.executions.AbstractExecution; | ||
import org.bukkit.Material; | ||
import org.bukkit.entity.HumanEntity; | ||
import org.bukkit.entity.Player; | ||
|
||
import static igorlink.service.Utils.announce; | ||
|
||
public class DropActiveItem extends AbstractExecution { | ||
|
||
@Override | ||
public Boolean execute(String donationUsername, Player player) { | ||
if (player.getEquipment().getItemInMainHand().getType() == Material.AIR) { | ||
announce(donationUsername, "безуспешно пытался выбить у тебя предмет из рук", "безуспешно пытался выбить предмет из рук", player, true); | ||
} else { | ||
announce(donationUsername, "выбил у тебя предмет из рук", "выбил предмет из рук", player, true); | ||
((HumanEntity) player).dropItem(true); | ||
player.updateInventory(); | ||
} | ||
return true; | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
...onexecutor/executionsstaff/executionsmanagement/executions/inventory/ShitToInventory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package igorlink.donationexecutor.executionsstaff.executionsmanagement.executions.inventory; | ||
|
||
import igorlink.donationexecutor.executionsstaff.executionsmanagement.executions.AbstractExecution; | ||
import igorlink.service.MainConfig; | ||
import org.bukkit.Material; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.inventory.ItemStack; | ||
import org.bukkit.inventory.meta.ItemMeta; | ||
|
||
import java.util.Arrays; | ||
|
||
import static igorlink.service.Utils.announce; | ||
|
||
public class ShitToInventory extends AbstractExecution { | ||
|
||
@Override | ||
public Boolean execute(String donationUsername, Player player) { | ||
announce(donationUsername, "насрал тебе в инвентарь", "насрал в инвентарь", player, true); | ||
Material itemType = Material.DIRT; | ||
ItemStack itemStack = new ItemStack(itemType, 64); | ||
ItemMeta meta = itemStack.getItemMeta(); | ||
meta.setDisplayName("§cГОВНО ОТ §f" + donationUsername.toUpperCase()); | ||
meta.setLore(Arrays.asList("§7Это говно ужасно вонюче и занимает много места")); | ||
itemStack.setItemMeta(meta); | ||
for (int i = 0; i < MainConfig.dirtAmount; i++) { | ||
player.getInventory().addItem(itemStack); | ||
} | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.