-
Notifications
You must be signed in to change notification settings - Fork 0
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
9 changed files
with
77 additions
and
75 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
10 changes: 3 additions & 7 deletions
10
src/main/java/com/eofitg/hardcore/cmdoperation/CommandRegister.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 |
---|---|---|
@@ -1,21 +1,17 @@ | ||
package com.eofitg.hardcore.cmdoperation; | ||
|
||
import com.eofitg.hardcore.ConfigReader; | ||
import org.bukkit.Bukkit; | ||
|
||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
public class CommandRegister { | ||
public static void register (List<String> cmdNames) { | ||
public static void register(List<String> cmdNames) { | ||
for (String cmdName : cmdNames) { | ||
CommandRegister.register(cmdName); | ||
} | ||
} | ||
public static void register (String cmdName) { | ||
List<String> cmdList = ConfigReader.getCmdList(cmdName); | ||
for (String s : cmdList) { | ||
Objects.requireNonNull(Bukkit.getPluginCommand(s)).setExecutor(new CommandHandler()); | ||
} | ||
public static void register(String cmdName) { | ||
Objects.requireNonNull(Bukkit.getPluginCommand(cmdName)).setExecutor(new CommandHandler()); | ||
} | ||
} |
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
17 changes: 17 additions & 0 deletions
17
src/main/java/com/eofitg/hardcore/cmdoperation/TabCompleterRegister.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,17 @@ | ||
package com.eofitg.hardcore.cmdoperation; | ||
|
||
import org.bukkit.Bukkit; | ||
|
||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
public class TabCompleterRegister { | ||
public static void register(List<String> cmdNames) { | ||
for (String cmdName : cmdNames) { | ||
TabCompleterRegister.register(cmdName); | ||
} | ||
} | ||
public static void register(String cmdName) { | ||
Objects.requireNonNull(Bukkit.getPluginCommand(cmdName)).setTabCompleter(new TabCompleter()); | ||
} | ||
} |
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
22 changes: 22 additions & 0 deletions
22
src/main/java/com/eofitg/hardcore/listener/PointListener.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,22 @@ | ||
package com.eofitg.hardcore.listener; | ||
|
||
import com.eofitg.hardcore.ConfigReader; | ||
import com.eofitg.hardcore.Hardcore; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.EventHandler; | ||
import org.bukkit.event.Listener; | ||
import org.bukkit.event.entity.EntityDamageEvent; | ||
|
||
public class PointListener implements Listener { | ||
@EventHandler | ||
public void getDamage(EntityDamageEvent e) { | ||
if (e.getEntity() instanceof Player) { | ||
String name = e.getEntity().getName(); | ||
int damage = (int) e.getDamage(); | ||
//e.getEntity().sendMessage(name + " " + e.getCause() + " " + e.getDamage()); | ||
int point = ConfigReader.getPoint(name) - damage; | ||
ConfigReader.setPoint(name, point); | ||
Hardcore.getInstance().saveConfig(); | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
playerNames: | ||
alive: | ||
point: | ||
commandNames: [ hardcore ] | ||
commands: | ||
hardcore: [ hardcore, hardcoremode ] | ||
on: false | ||
enable: false |