This repository has been archived by the owner on Dec 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from kacperduras/development
1.1.0 release.
- Loading branch information
Showing
8 changed files
with
281 additions
and
2 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
62 changes: 62 additions & 0 deletions
62
src/main/java/pl/kacperduras/protocoltab/skript/EffSetFooter.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,62 @@ | ||
/* | ||
Copyright 2017 Kacper Duras | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
package pl.kacperduras.protocoltab.skript; | ||
|
||
import ch.njol.skript.Skript; | ||
import ch.njol.skript.lang.Effect; | ||
import ch.njol.skript.lang.Expression; | ||
import ch.njol.skript.lang.SkriptParser; | ||
import ch.njol.util.Kleenean; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.Event; | ||
import pl.kacperduras.protocoltab.ProtocolTabAPI; | ||
|
||
public class EffSetFooter extends Effect { | ||
|
||
private Expression<Player> playerExpression; | ||
private Expression<String> stringExpression; | ||
|
||
static { | ||
Skript.registerEffect(EffSetFooter.class, "set %player%'s footer to %string%"); | ||
} | ||
|
||
@Override | ||
protected void execute(Event event) { | ||
Player player = this.playerExpression.getSingle(event); | ||
String string = this.stringExpression.getSingle(event); | ||
|
||
if (player == null || string == null) { | ||
return; | ||
} | ||
|
||
ProtocolTabAPI.getTablist(player).setFooter(string); | ||
} | ||
|
||
@Override | ||
@SuppressWarnings("unchecked") | ||
public boolean init(Expression<?>[] expressions, int i, Kleenean kleenean, SkriptParser.ParseResult parseResult) { | ||
this.playerExpression = (Expression<Player>) expressions[0]; | ||
this.stringExpression = (Expression<String>) expressions[1]; | ||
|
||
return true; | ||
} | ||
|
||
@Override | ||
public String toString(Event event, boolean b) { | ||
return this.getClass().getName(); | ||
} | ||
|
||
} |
62 changes: 62 additions & 0 deletions
62
src/main/java/pl/kacperduras/protocoltab/skript/EffSetHeader.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,62 @@ | ||
/* | ||
Copyright 2017 Kacper Duras | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
package pl.kacperduras.protocoltab.skript; | ||
|
||
import ch.njol.skript.Skript; | ||
import ch.njol.skript.lang.Effect; | ||
import ch.njol.skript.lang.Expression; | ||
import ch.njol.skript.lang.SkriptParser; | ||
import ch.njol.util.Kleenean; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.Event; | ||
import pl.kacperduras.protocoltab.ProtocolTabAPI; | ||
|
||
public class EffSetHeader extends Effect { | ||
|
||
private Expression<Player> playerExpression; | ||
private Expression<String> stringExpression; | ||
|
||
static { | ||
Skript.registerEffect(EffSetHeader.class, "set %player%'s header to %string%"); | ||
} | ||
|
||
@Override | ||
protected void execute(Event event) { | ||
Player player = this.playerExpression.getSingle(event); | ||
String string = this.stringExpression.getSingle(event); | ||
|
||
if (player == null || string == null) { | ||
return; | ||
} | ||
|
||
ProtocolTabAPI.getTablist(player).setHeader(string); | ||
} | ||
|
||
@Override | ||
@SuppressWarnings("unchecked") | ||
public boolean init(Expression<?>[] expressions, int i, Kleenean kleenean, SkriptParser.ParseResult parseResult) { | ||
this.playerExpression = (Expression<Player>) expressions[0]; | ||
this.stringExpression = (Expression<String>) expressions[1]; | ||
|
||
return true; | ||
} | ||
|
||
@Override | ||
public String toString(Event event, boolean b) { | ||
return this.getClass().getName(); | ||
} | ||
|
||
} |
65 changes: 65 additions & 0 deletions
65
src/main/java/pl/kacperduras/protocoltab/skript/EffSetSlot.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,65 @@ | ||
/* | ||
Copyright 2017 Kacper Duras | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
package pl.kacperduras.protocoltab.skript; | ||
|
||
import ch.njol.skript.Skript; | ||
import ch.njol.skript.lang.Effect; | ||
import ch.njol.skript.lang.Expression; | ||
import ch.njol.skript.lang.SkriptParser; | ||
import ch.njol.util.Kleenean; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.Event; | ||
import pl.kacperduras.protocoltab.ProtocolTabAPI; | ||
|
||
public class EffSetSlot extends Effect { | ||
|
||
static { | ||
Skript.registerEffect(EffSetSlot.class, "set %player%'s slot number %integer% to %string%"); | ||
} | ||
|
||
private Expression<Player> playerExpression; | ||
private Expression<Integer> integerExpression; | ||
private Expression<String> stringExpression; | ||
|
||
@Override | ||
protected void execute(Event event) { | ||
Player player = this.playerExpression.getSingle(event); | ||
Integer integer = this.integerExpression.getSingle(event); | ||
String string = this.stringExpression.getSingle(event); | ||
|
||
if (player == null || string == null || integer == null) { | ||
return; | ||
} | ||
|
||
ProtocolTabAPI.getTablist(player).setSlot(integer, string); | ||
} | ||
|
||
@Override | ||
@SuppressWarnings("unchecked") | ||
public boolean init(Expression<?>[] expressions, int i, Kleenean kleenean, SkriptParser.ParseResult parseResult) { | ||
this.playerExpression = (Expression<Player>) expressions[0]; | ||
this.integerExpression = (Expression<Integer>) expressions[1]; | ||
this.stringExpression = (Expression<String>) expressions[2]; | ||
|
||
return true; | ||
} | ||
|
||
@Override | ||
public String toString(Event event, boolean b) { | ||
return this.getClass().getName(); | ||
} | ||
|
||
} |
57 changes: 57 additions & 0 deletions
57
src/main/java/pl/kacperduras/protocoltab/skript/EffUpdateTablist.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,57 @@ | ||
/* | ||
Copyright 2017 Kacper Duras | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
package pl.kacperduras.protocoltab.skript; | ||
|
||
import ch.njol.skript.Skript; | ||
import ch.njol.skript.lang.Effect; | ||
import ch.njol.skript.lang.Expression; | ||
import ch.njol.skript.lang.SkriptParser; | ||
import ch.njol.util.Kleenean; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.Event; | ||
import pl.kacperduras.protocoltab.ProtocolTabAPI; | ||
|
||
public class EffUpdateTablist extends Effect { | ||
|
||
static { | ||
Skript.registerEffect(EffUpdateTablist.class, "update %player%'s tablist"); | ||
} | ||
|
||
private Expression<Player> playerExpression; | ||
|
||
@Override | ||
protected void execute(Event event) { | ||
Player player = this.playerExpression.getSingle(event); | ||
if (player == null) { | ||
return; | ||
} | ||
|
||
ProtocolTabAPI.getTablist(player).update(); | ||
} | ||
|
||
@Override | ||
@SuppressWarnings("unchecked") | ||
public boolean init(Expression<?>[] expressions, int i, Kleenean kleenean, SkriptParser.ParseResult parseResult) { | ||
this.playerExpression = (Expression<Player>) expressions[0]; | ||
return true; | ||
} | ||
|
||
@Override | ||
public String toString(Event event, boolean b) { | ||
return this.getClass().toString(); | ||
} | ||
|
||
} |