Skip to content

Commit be0d6d4

Browse files
author
kangarko
committed
Open source under GPL
1 parent 2cb3245 commit be0d6d4

File tree

137 files changed

+19927
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+19927
-0
lines changed

.gitignore

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#################
2+
## IDEA
3+
#################
4+
5+
# User-specific stuff
6+
.idea/
7+
.idea_modules/
8+
*.iml
9+
10+
# IntelliJ
11+
out/
12+
13+
target/
14+
15+
#################
16+
## Eclipse
17+
#################
18+
19+
*.pydevproject
20+
.project
21+
.metadata
22+
bin/
23+
tmp/
24+
*.tmp
25+
*.bak
26+
*.swp
27+
*~.nib
28+
local.properties
29+
.classpath
30+
.settings/
31+
.loadpath
32+
.apt_generated/
33+
.apt_generated_tests/
34+
35+
# Avoid ignoring Maven wrapper jar file (.jar files are usually ignored)
36+
!/.mvn/wrapper/maven-wrapper.jar
37+
38+
# External tool builders
39+
.externalToolBuilders/
40+
41+
# Locally stored "Eclipse launch configurations"
42+
*.launch
43+
44+
# CDT-specific
45+
.cproject
46+
47+
# PDT-specific
48+
.buildpath
49+
50+
# Builder
51+
builder.xml
52+
build.xml
53+
54+
#############
55+
## Windows detritus
56+
#############
57+
58+
# Windows image file caches
59+
Thumbs.db
60+
ehthumbs.db
61+
62+
# Folder config file
63+
Desktop.ini
64+
65+
# Recycle Bin used on file shares
66+
$RECYCLE.BIN/
67+
68+
# Mac crap
69+
.DS_Store
70+
REBASE.bat
71+
72+
library/

LICENSE.md

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ If you have any **questions or bugs to report**, you are welcome to **fill an is
1919

2020
Check out https://www.spigotmc.org/resources/46497 for more information.
2121

22+
# Compiling
23+
24+
1. Obtain Foundation from github.com/kangarko/Foundation
25+
2. Create library/ folder in Boss/ and obtain binaries described in pom.xml. You have to obtain them yourself. Regarding Boss, you can just remove the very few references to it in the source code and remove the dependency from pom.xml.
26+
3. Compile Foundation and Boss using Maven with the "clean install" goal.
27+
2228
<hr>
2329

2430
Dave Thomas, founder of OTI, godfather of the Eclipse strategy:

pom.xml

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<groupId>org.mineacademy</groupId>
7+
<artifactId>Boss</artifactId>
8+
<version>3.9.3</version>
9+
<packaging>jar</packaging>
10+
11+
<properties>
12+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
13+
<author>kangarko</author>
14+
<plugin.name>boss</plugin.name>
15+
<main.class>${project.groupId}.${plugin.name}.BossPlugin</main.class>
16+
</properties>
17+
18+
<repositories>
19+
<repository>
20+
<id>mineacademy-repo</id>
21+
<url>https://bitbucket.org/kangarko/libraries/raw/master</url>
22+
</repository>
23+
</repositories>
24+
25+
<dependencies>
26+
<dependency>
27+
<groupId>org.mineacademy</groupId>
28+
<artifactId>Foundation</artifactId>
29+
<version>LATEST</version>
30+
</dependency>
31+
32+
<!-- Premium dependencies, stored locally -->
33+
<dependency>
34+
<groupId>org.mineacademy.plugin</groupId>
35+
<artifactId>Heroes</artifactId>
36+
<version>1.9.3</version>
37+
<scope>system</scope>
38+
<systemPath>${basedir}/library/Heroes-1.9.3.jar</systemPath>
39+
</dependency>
40+
<dependency>
41+
<groupId>org.mineacademy.plugin</groupId>
42+
<artifactId>GriefPrevention</artifactId>
43+
<version>16.15.0</version>
44+
<scope>system</scope>
45+
<systemPath>${basedir}/library/GriefPrevention-16.15.0.jar</systemPath>
46+
</dependency>
47+
48+
<!-- Dependencies from our repository -->
49+
<dependency>
50+
<groupId>org.mineacademy.plugin</groupId>
51+
<artifactId>SilkSpawners</artifactId>
52+
<version>6.3.1</version>
53+
</dependency>
54+
</dependencies>
55+
56+
<build>
57+
<plugins>
58+
<plugin>
59+
<groupId>org.apache.maven.plugins</groupId>
60+
<artifactId>maven-jar-plugin</artifactId>
61+
<version>3.2.0</version>
62+
</plugin>
63+
<plugin>
64+
<groupId>org.apache.maven.plugins</groupId>
65+
<artifactId>maven-compiler-plugin</artifactId>
66+
<version>3.8.1</version>
67+
<configuration>
68+
<source>1.8</source>
69+
<target>1.8</target>
70+
</configuration>
71+
</plugin>
72+
<plugin>
73+
<groupId>org.apache.maven.plugins</groupId>
74+
<artifactId>maven-shade-plugin</artifactId>
75+
<version>3.2.2</version>
76+
<executions>
77+
<execution>
78+
<phase>package</phase>
79+
<goals>
80+
<goal>shade</goal>
81+
</goals>
82+
</execution>
83+
</executions>
84+
<configuration>
85+
<createDependencyReducedPom>false</createDependencyReducedPom>
86+
<artifactSet>
87+
<includes>
88+
<include>org.mineacademy:Foundation*</include>
89+
</includes>
90+
</artifactSet>
91+
<relocations>
92+
<relocation>
93+
<pattern>org.mineacademy</pattern>
94+
<shadedPattern>org.mineacademy.${plugin.name}.lib</shadedPattern>
95+
<excludes>
96+
<exclude>org.mineacademy.${plugin.name}.**</exclude>
97+
</excludes>
98+
</relocation>
99+
</relocations>
100+
</configuration>
101+
</plugin>
102+
</plugins>
103+
<resources>
104+
<resource>
105+
<directory>src/main/resources</directory>
106+
<filtering>true</filtering>
107+
</resource>
108+
</resources>
109+
</build>
110+
</project>
Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
package org.mineacademy.boss;
2+
3+
import java.util.Arrays;
4+
import java.util.List;
5+
6+
import org.bukkit.entity.Player;
7+
import org.mineacademy.boss.api.BossSkillRegistry;
8+
import org.mineacademy.boss.hook.BossHeroesHook;
9+
import org.mineacademy.boss.hook.GriefPreventionHook;
10+
import org.mineacademy.boss.hook.SilkSpawnersHook;
11+
import org.mineacademy.boss.hook.StackMobListener;
12+
import org.mineacademy.boss.listener.BossSpawnerListener;
13+
import org.mineacademy.boss.listener.EntityListener;
14+
import org.mineacademy.boss.listener.FreezeListener;
15+
import org.mineacademy.boss.listener.PlayerListener;
16+
import org.mineacademy.boss.listener.SpawningListener;
17+
import org.mineacademy.boss.menu.MenuToolsBoss;
18+
import org.mineacademy.boss.model.BossCommandGroup;
19+
import org.mineacademy.boss.model.BossManager;
20+
import org.mineacademy.boss.model.BossPlayer;
21+
import org.mineacademy.boss.model.task.BossKeepTask;
22+
import org.mineacademy.boss.model.task.BossRetargetTask;
23+
import org.mineacademy.boss.model.task.BossSkillTask;
24+
import org.mineacademy.boss.model.task.BossTimedSpawnTask;
25+
import org.mineacademy.boss.settings.Localization;
26+
import org.mineacademy.boss.settings.Settings;
27+
import org.mineacademy.boss.storage.SimplePlayerData;
28+
import org.mineacademy.boss.storage.SimpleSpawnerData;
29+
import org.mineacademy.boss.storage.SimpleTagData;
30+
import org.mineacademy.fo.Common;
31+
import org.mineacademy.fo.MinecraftVersion.V;
32+
import org.mineacademy.fo.Valid;
33+
import org.mineacademy.fo.collection.StrictMap;
34+
import org.mineacademy.fo.command.SimpleCommandGroup;
35+
import org.mineacademy.fo.model.SpigotUpdater;
36+
import org.mineacademy.fo.plugin.SimplePlugin;
37+
import org.mineacademy.fo.remain.Remain;
38+
import org.mineacademy.fo.settings.YamlStaticConfig;
39+
40+
/**
41+
* The main class for the Boss plugin.
42+
*/
43+
public final class BossPlugin extends SimplePlugin {
44+
45+
/**
46+
* Store temporary players' data until BOSS restarts.
47+
*/
48+
private static final StrictMap<String, BossPlayer> playerCache = new StrictMap<>();
49+
50+
/**
51+
* Class responsible for loading, saving, and creating Bosses.
52+
*/
53+
private final BossManager bossManager = new BossManager();
54+
55+
/**
56+
* The main /boss command, capable of handling subcommands such as /boss region.
57+
*/
58+
private final BossCommandGroup bossCommand = new BossCommandGroup();
59+
60+
@Override
61+
protected String[] getStartupLogo() {
62+
return new String[] {
63+
"&e______ ",
64+
"&e(____ \\ ",
65+
"&e ____) ) ___ ___ ___ ",
66+
"&e| __ ( / _ \\ /___)/___)",
67+
"&e| |__) ) |_| |___ |___ |",
68+
"&6|______/ \\___/(___/(___/ ",
69+
" "
70+
};
71+
}
72+
73+
@Override
74+
protected void onPluginStart() {
75+
MenuToolsBoss.getInstance();
76+
77+
if (!Remain.hasScoreboardTags())
78+
SimpleTagData.$();
79+
80+
SimplePlayerData.$();
81+
82+
registerEvents(new PlayerListener());
83+
registerEvents(new EntityListener());
84+
registerEvents(new SpawningListener());
85+
registerEvents(new BossSpawnerListener());
86+
registerEvents(new FreezeListener());
87+
88+
if (Common.doesPluginExist("Heroes"))
89+
BossHeroesHook.setEnabled(true);
90+
91+
if (Common.doesPluginExist("GriefPrevention"))
92+
GriefPreventionHook.setEnabled(true);
93+
94+
Common.ADD_TELL_PREFIX = true;
95+
96+
// Delay after start because we check the world, so Multiverse must load it
97+
// first
98+
Common.runLater(SimpleSpawnerData::$);
99+
100+
Common.runLater(10, () -> SimpleTagData.$().clear());
101+
102+
Common.log(
103+
" ",
104+
"Tutorial:",
105+
"&6https://github.com/kangarko/Boss/wiki",
106+
" ",
107+
"Get help:",
108+
"&6https://github.com/kangarko/Boss/issues",
109+
"&8" + Common.consoleLineSmooth());
110+
111+
if (Settings.TimedSpawning.ENABLED && (Common.doesPluginExistSilently("Top") || Common.doesPluginExistSilently("TopLite") || Common.doesPluginExistSilently("MassiveLag")))
112+
Common.runLaterAsync(10, () -> Common.logFramed(false,
113+
"[Boss] Notice for Anti-Lag Plugins",
114+
" ",
115+
"Boss is a greatly optimized plugin, however timed",
116+
"spawning must use the main thread for safety.",
117+
"Depending on your settings, this may be shown",
118+
"in your Top / MassiveLag. You can ignore this."));
119+
}
120+
121+
@Override
122+
protected void onPluginReload() {
123+
SimpleSpawnerData.$().save();
124+
}
125+
126+
/**
127+
* Start the parts of the plugin that support /boss reload or /reload function.
128+
*/
129+
@Override
130+
protected void onReloadablesStart() {
131+
BossSkillRegistry.registerDefaults();
132+
133+
Common.runLater(() -> bossManager.loadBosses());
134+
135+
Common.runTimer(10, 20, new BossSkillTask());
136+
Common.runTimer(10, Settings.Fight.Target.DELAY.getTimeTicks(), new BossRetargetTask());
137+
138+
if (Settings.TimedSpawning.ENABLED)
139+
Common.runTimer(Settings.TimedSpawning.DELAY.getTimeTicks(), new BossTimedSpawnTask());
140+
141+
if (Settings.RegionKeep.ENABLED)
142+
Common.runTimer(Settings.RegionKeep.PERIOD.getTimeTicks(), new BossKeepTask());
143+
144+
if (Common.doesPluginExistSilently("SilkSpawners"))
145+
registerEvents(new SilkSpawnersHook());
146+
147+
registerEventsIf(new StackMobListener(), Common.doesPluginExistSilently("StackMob"));
148+
}
149+
150+
public static BossPlayer getDataFor(final Player player) {
151+
Valid.checkNotNull(player, "Player = null");
152+
153+
BossPlayer cache = playerCache.get(player.getName());
154+
155+
if (cache == null) {
156+
cache = new BossPlayer();
157+
158+
playerCache.put(player.getName(), cache);
159+
160+
}
161+
162+
return cache;
163+
}
164+
165+
public static BossManager getBossManager() {
166+
return ((BossPlugin) SimplePlugin.getInstance()).bossManager;
167+
}
168+
169+
@Override
170+
public List<Class<? extends YamlStaticConfig>> getSettings() {
171+
return Arrays.asList(Settings.class, Localization.class);
172+
}
173+
174+
@Override
175+
public int getFoundedYear() {
176+
return 2017; // 17.07
177+
}
178+
179+
@Override
180+
public SimpleCommandGroup getMainCommand() {
181+
return bossCommand;
182+
}
183+
184+
@Override
185+
public SpigotUpdater getUpdateCheck() {
186+
return new SpigotUpdater(46497);
187+
}
188+
189+
@Override
190+
public V getMinimumVersion() {
191+
return V.v1_8;
192+
}
193+
}

0 commit comments

Comments
 (0)